- Home /
Strumpy Parallax Shader
Would anyone with more shader programming experience help me make a parallax shader with Strumpy Shader Editor: Here's what i've got so far: http://imageshack.us/photo/my-images/193/graphpf.jpg/
Now the results look weird...Maybe theres some nodes missing...Any help would be appreciated
Answer by SimAtanasov · Jan 15, 2012 at 04:40 PM
I know this question is old, but since it's unanswered, I thought I'd give it a go.
First thing is, apparently since Unity 3, every time a normal map texture is set to normal map at import, the alpha channel is erased. The parallax offset in SSE still requires an alpha channel to be able to calculate the height map. This can be your starting point. I personally haven't gotten much further, but I have some positive results.
What you can do is create two texture inputs - one for a normal map (who's "RGBA" goes in to the "view" port of the parallax map block, and one height map, which is a plane texture, with the height data added to an alpha channel (who's "A" goes into the "height" port of the parallax map block). This should do for the parallax.
Next up is how to fit that into the "normal" port of the master. Well instead of Tex2DNormal block, use an Add block and send the "RGBA" of your Normal map texture input to "Arg1" of the Add block and the "result" from the Parallax block to "Arg2" of the Add block.
UVs from the parallax or normal maps, don't really need to be sent to the diffuse, since to achieve any good effect, you should be using proper co-responding textures, where the UVs should match by default.
Hope this helps!
IMPORTANT EDIT - please read ------------------------------
Ok, after a little research, I found out that in fact you do have to share the result from the parallax offset to the UVs to both diffuse and Normal. Do that by using Add and mixing the UV from the original Sampler2Ds and the Parallax result.
Another important thing is to use ViewDirection block in to the "view" port of the parallax block, instead of the RGBA of the Normal map. The reason for that is that the shader needs to calculate the parallax offset according the view and since the Normal Map is static, there won't be any difference when you change the view. So if you use ViewDirection, it actually takes the view position to calculate the parallax offset.
Your answer
Follow this Question
Related Questions
Help Fixing Warnings in this Shader? 2 Answers
2sided Shader - Strumpy Shader Editor 1 Answer
Strumpy shaders... Y U NO dynamic batch ?? 0 Answers
Shader Errors Strumpy Shader Editor 2 Answers
Strumpy Shader working in editor but not in build. 0 Answers