Home Technical Talk

[ShaderFX] [Maya] Two simple passes error.. doing something wrong? bug? limitation?

asdfg9
null
Offline / Send Message
asdfg9 null


PROBLEM:
See the image below, two simple passes, draw pass1, overwrite with pass2, should end up seeing the second pass, but theres an error.
It works if you disconnect one of the pixel shader color inputs (so it gets autoassigned black) but if both have color input like in the image, it errors out.

(note that you have to be in dx11 viewport mode. if you're using opengl mode, the error behavior might be different and maya might not show an error message but the graph wont compute properly if you then try to change the colors to verify it will stay in some error state color (green or white most likely, even if you change the colors to black to verify)


FURTHER DETAILS / OBSERVATIONS:
it turns out it probably has to do with hardware fog related code that shaderfx autoinserts into the pipeline (you can see that data if you save the shader to disk as hlsl3/5 (or any other i guess)  via the property window of the hw shader node or you can read the error log in script editor (scroll up alot to find the error line)).

That fog related code can produce errors under various circumstances:
1 - the code for example gets inserted multiple times into a shared vertexshader for each pixel shader in the code that has color input assigned (but if theres no input, that pixelshader wont require the fog data from the vs). error produced by this situation is redeclaration of _HPosition

2 - or theres are missing fog related input vars that the vertexshader expects in a case where we try to use separate vertexshader for each pass, which produces errors of trying to access WorldPosition var that the vs expects for the fog computation that isnt declared in the input/output struct


TRIED:
I tried building separate vertex shaders from scratch for each pass instead of using the premade vs group node (shaderfx.com tutorial) and renamed each var and texcoord unique names but the resulting code didnt seem to be fully obeying the graph and result was either the same or bit different problems arose with non matching vsinput struct names that get generated/expected when using multiple vertexshaders but thats offtopic to the fog thing, the passes however did work if plugged in on their own, just never together). either way i never managed to create a graph that would make this simple two pass scenario actually compute once. it works fine if i remove the fog code in the exported hlsl and run it with mayas dx11shader.


this image graph produces the error (be in dx11 viewport mode):



if anything, i'd love to hear a confirmation that its not happening just for me, whether its possible to stop the fog code from getting generated or whether im actually managing to do something wrong in this simple example >< 


tested on: maya2017/2018, win8.1 64, Ati HD7950, both dx11/ogl viewport modes




Replies

Sign In or Register to comment.