JohnK Posted November 13, 2015 Share Posted November 13, 2015 Sometimes the shader I am creating will be given an image file to use as a texture sampler and sometimes it will not. In the shader when the image file is given I need the lineuniform sampler2D refTexture;and in the main function a line along the lines offloat x = 0.5 * texture2D(refSampler, uv).rgb.x;and when no image file is given thenfloat x = 0.5 * position.xFrom looking at the code in the samplers in the materialsLibrary I see there are some conditions on the uniforms such as#if defined(SPOTLIGHT0) || defined(DIRLIGHT0)varying vec4 vPositionFromLight0;uniform sampler2D shadowSampler0;#elseuniform samplerCube shadowSampler0;#endif1. Is there a condition I can use for#if ..................uniform sampler2D refTexture;#endif2. Is there a conditional statement within the main function I can use forIF texture loaded float x = 0.5 * texture2D(refSampler, uv).rgb.x;ELSE float x = 0.5 * position.xENDIF Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.