0
Fixed

Vertex Blending: Multiply a texture with a vertex colour?

robert briscoe 11 років тому оновлено Freya Holmér (Developer) 11 років тому 13

Hi,


So I've been experimenting with vertex blending two materials together using the vertex colour/alpha node, and my initial tests were successful, however, if I try to multiply the vertex alpha with a texture I get no results. Basically I'm trying to use a height map to modulate the blending between layers as seen in this image: Image 37


Is this a feature that has yet to be implemented, or a bug?

Відповідь

Відповідь
Fixed

This is now fixed in Alpha 0.12! Main node connectors will now typecast both Vector1 and Vector2 to the format they require

It should work. Are you 100% sure the alpha channel has information in both the vertices and the texture?

Yep the texture alpha and the vertex alpha channel definitely have info there, but the problem is with using the texture alpha channel with the vertex alpha channel - Multiplying by R,G or B works, just not the texture's alpha channel for some reason. Also, when you hook the vertex alpha Texture Alpha up to the emission on it's own, it fails to display it - possibly the root of the issue?

Note that this is on an unlit shader, if that makes any difference


Edit: tried this on Lit, Phong etc. and on different outputs. The texture alpha channel is displayed in the shader editor, but not in the engine.

(With the same setup that you've got in the screenshot)

I'll check it out as soon as SF is compilable again! I'm in the middle of making changes :)

No problem. 

Also noticed another odd bug: One Minus doesn't work when plugging a single channel in from a texture

This is odd, I'm not having any of the issues you are mentioning, everything seems to work fine on my end. What is the simplest case where it goes wrong with the one-minus case?

Also, are you sure you have assigned the textures to the actual material that you use in-game?

I've put together a package with the problem shaders which you can take a look at here: http://www.littlelostpoly.co.uk/PVT/ShaderTests.unitypackage


On closer inspection it all seems to stem from disabling "Receive ambient lighting" on unlit materials


This is what I see on my end:


Ah, I see :) Thanks a bunch for the package!

This is all due to the master node not filtering the input. 


You're sending in a Vector 1 / Value into the Emission, instead of a Vector 3. It works when you have ambient light on, becuase the ambient term is added together with the emissive, which returns a Vector3. If you want a temporary fix, you can do this:




I'll try and get this sorted for the next version :)

After Multiplying all emissive with Vector3(1,1,1): 



ok thanks, will use that as a temp fix for now! Glad we got to the bottom of it!

Відповідь
Fixed

This is now fixed in Alpha 0.12! Main node connectors will now typecast both Vector1 and Vector2 to the format they require