helmut.bressler Posted July 7, 2021 Share Posted July 7, 2021 Hello, how can I generate a preprocessor define for a pass in a ULON material which depends on a state or a condition? The only way to do that I have encountered in the SDK is the following snippet from the particle base material: Pass ambient if[!ambient] { Vertex = "core/shaders/particles/vertex/ambient.vert" Fragment = "core/shaders/particles/fragment/ambient.frag" } Pass ambient if[ambient] <defines="AMBIENT"> { Vertex = "core/shaders/particles/vertex/ambient.vert" Fragment = "core/shaders/particles/fragment/ambient.frag" } This works well if I want to define something based on a single state, but the number of passes quickly grows when I increase the number of states. Alternatively, is there support for defines affecting all shaders in the ULON material format, something like <state name="some_switch" items="state0,state1,state2" defines="name_items"/> ? Many thanks Helmut Link to comment
sweetluna Posted July 7, 2021 Share Posted July 7, 2021 Hi, you should be able to just use PASS_AMBIENT define in shader. #ifdef PASS_AMBIENT // Ambient shader #else // Something else #endif Quote Alternatively, is there support for defines affecting all shaders in the ULON material format, something like <state name="some_switch" items="state0,state1,state2" defines="name_items"/> yes, just do State some_switch = 0 <items=[state0 state1 state2]> same as StateSwitch some_switch = 0 <items=[state0 state1 state2]> hope it helps! May RenderDoc/Nsight Graphics/Intel GPA bless you Link to comment
Recommended Posts