|
I need to use custom keywords in my cg shader, but so far I can't get them working. I looked at the Water4 shader and scripts - since it uses custom keywords - and tried to setup my files the same way, but so far I can't get it to work. Here's my shader( my custom keyword is in the "surf" function ): And here's my script: I should mention that the script is NOT in the same folder as the shader, and that I am not using Unity Pro. I'm using Unity 3.5 iPhone basic. I can't find any documentation on this issue, so I need a shader guru's help hehe :)
(comments are locked)
|
|
Hi you will notice that the water shader does this at the start: What this is saying is that the compiler needs to generate a permutation of the shader for each of those defines. There will be 3 combinations generated. One each for WATER_REFLECTIVE, WATER_REFRACTIVE, and WATER_SIMPLE. The shader compiler is very explicit about the permutations it generates. So if you have multiple flags that you want on / off use multiple multi_compile pragmas. Doing: Will generate these permutations: You do not need to use a given flag. In your example you would do: This would generate two permutations, one with IS_SIMPLE set one with IS_ADVANCED set. You don't need to use IS_ADVANCED. Let me know if you have any further troubles. Thanks for the answer stramit! I am not home right now so I can't give it a try, but I will tonight when I get home. Quick question: when you say "Doing: #pragma IS_SIMPLE IS_ADVANCED #pragma LIGHTING_ON LIGHTING_OFF", how come it's not "#pragma multi_compile"? Do i need to define first "#pragma multi-compile IS_SIMPLE IS_ADVANCED" and then do "#pragma IS_SIMPLE IS_ADVANCE"? Just a little confused, sorry if this seems like a stupid question!
Mar 30 '12 at 07:05 PM
ronronmx
(comments are locked)
|
