Hello Ventuzians!
THE FORUMS ARE CLOSED!

Please join our discord server HERE!! << click me :D

We are shutting our Ventuz Forum, but don't worry, it will all be archived for you to search in if you have a query. From now on, please add all your comments, questions or observations into our Discord Server

Thanks for the great time - see you on discord!!
Dee, Karol, Daniel and the whoooole Product and Support team!

Help! "Multiply" transparency..?

Q and A about functionality and how to solve a special task for your application.

Moderator: Support

mrmacmusic
Posts: 43
Joined: 03 Apr 2013, 09:34

Help! "Multiply" transparency..?

Post by mrmacmusic » 23 Apr 2013, 09:00

I'm hoping someone can help with an urgent request... is it possible to replicate the effect of having a layer "multiply" the layer beneath as in Photoshop?

I need to place logos over an animated background, but rather than simple alpha transparency, the colours in the logo needs to multiply with the (grayscale) layer below. Can this be done using the Texture Shading Editor, and if so.. how?!? :oops:

Thanks in advance!

mrmacmusic
Posts: 43
Joined: 03 Apr 2013, 09:34

Re: Help! "Multiply" transparency..?

Post by mrmacmusic » 23 Apr 2013, 12:33

Alex Klein wrote:Not completely sure, but I think that's not possible with the DirectX fixed function pipeline texture shading. Simplest solution is to use an HLSL node, use the trivial vertex shader that is automatically filled in and simply do the multiply in the pixel shader. Check out http://www.ventuz.com/support/help/late ... hader.html , you should only need a very basic knowledge of HLSL that you should be able to google/read up in an hour or less... perhaps if you google for hlsl shaders, you will even find a suitable code. Unfortunately, I don't have any time at all at the moment to code it myself, but it's really, really easy. Hope it helps...

Alex
Thanks Alex – I will go Googling now that our internet has returned... we've been disconnected all morning :x

User avatar
ErikB
Posts: 212
Joined: 10 Jan 2012, 12:52

Re: Help! "Multiply" transparency..?

Post by ErikB » 29 Apr 2013, 13:41

We do have the Texture Mixer Shader http://www.ventuz.com/support/help/late ... Mixer.html which might allow you to do what you need.

mrmacmusic
Posts: 43
Joined: 03 Apr 2013, 09:34

Re: Help! "Multiply" transparency..?

Post by mrmacmusic » 29 Apr 2013, 13:47

ErikB wrote:We do have the Texture Mixer Shader http://www.ventuz.com/support/help/late ... Mixer.html which might allow you to do what you need.
Thanks for that – I will check it out.

I was just about to post to say that I've not had the chance to get my head round programming my own Multiply Blend shader, and now the client definitely wants this look rather than boring old alpha transparency.... I know programming one should be relatively simple, but now I'm struggling. So much to learn, so little time...! :?

mrmacmusic
Posts: 43
Joined: 03 Apr 2013, 09:34

Re: Help! "Multiply" transparency..?

Post by mrmacmusic » 29 Apr 2013, 16:25

Looks like it will need to be an HLSL shader, and if anyone can point me in the direction of how to make this work I'd be eternally grateful!

So, how do I get Ventuz to make sense of this blend function?

float4 Multiply (float4 cBase, float4 cBlend)
{
return (cBase * cBlend);
}

I guess I need to define what cBase and cBlend are, but I'm really not sure how to do that :? Can anyone help?!

mrmacmusic
Posts: 43
Joined: 03 Apr 2013, 09:34

Re: Help! "Multiply" transparency..?

Post by mrmacmusic » 30 Apr 2013, 11:16

I'm still desperately seeking help with this :oops:

By tweaking the basic HLSL node, I've solved one element of this project (a simple blue rectangle which needs to multiply the grayscale underlying layer)...

Code: Select all

float4x4 WorldViewProjection  : WORLDVIEWPROJECTION;

// Vertex shader program input
struct VS_INPUT
{
	float4 Position : POSITION;
};

// Vertex shader program output
struct VS_OUTPUT
{
	float4 Position : POSITION;
};

// Vertex Shader Program

VS_OUTPUT VS( VS_INPUT Input )
{
	VS_OUTPUT Output;

	// Transform the vertex from 3D object space to 2D screen space.
	Output.Position = mul(Input.Position, WorldViewProjection);
	
	return Output;
}

// Pixel Shader Program

float4 PS( VS_OUTPUT Input ) : COLOR
{
	return float4(0.1f, 0.15f, 0.4f, 0.1f);
}

technique Tech1
{
	pass pass0
	{
		vertexshader = compile vs_3_0 VS();
		pixelshader  = compile ps_3_0 PS();
		srcBlend = destColor;
		destBlend = srcAlpha;
	}
}
But I still need a shader that will not generate the blue colour itself (as the above code does), but instead it needs to use the colours of the existing texture which is next in the node tree (logo with alpha) to multiply the underlying layer... Can someone please help me get this working?!

chriss0212
Posts: 666
Joined: 18 Jan 2012, 20:56
Location: wuppertal
Contact:

Re: Help! "Multiply" transparency..?

Post by chriss0212 » 30 Apr 2013, 18:26

hi mr mac

can you post a simple photoshop file what shows what you like to have?

greetz

christian

mrmacmusic
Posts: 43
Joined: 03 Apr 2013, 09:34

Re: Help! "Multiply" transparency..?

Post by mrmacmusic » 01 May 2013, 08:35

chriss0212 wrote: can you post a simple photoshop file what shows what you like to have?

christian
No problem Christian – see attached screen grab which illustrates the layers.

Logo layer is coloured, has transparency, and is set to "Multiply" blend in Photoshop;
Base layer is a grayscale animated background (illustrated by the pattern in the screen grab).

Does this make things clearer?!
Attachments
multiply.png

User avatar
Götz_B
Posts: 180
Joined: 21 May 2013, 13:01

Re: Help! "Multiply" transparency..?

Post by Götz_B » 21 May 2013, 13:09

Did you already find a solution?
I wrote some HLSL code that might suit your needs.

mrmacmusic
Posts: 43
Joined: 03 Apr 2013, 09:34

Re: Help! "Multiply" transparency..?

Post by mrmacmusic » 22 May 2013, 08:27

Götz_B wrote:Did you already find a solution?
I wrote some HLSL code that might suit your needs.
Hi – I managed to fake it, but the result wasn't the "multiply" blend that I wanted. I would be interested to see your HLSL shader code if you don't mind sharing it?

Post Reply