- Home /
Custom Shaders Within JavaScript
Hello,
I'm trying to make my own custom shader within my JavaScript code. The problem I'm facing is that I can't seem to get more than one property within the shader. It's todo with my syntax layout - I've never worked with custom shaders before:
var shaderText =
"Shader \"Particles/Additive\" {" +
"Properties { _TintColor (\"Tint Color\", Colour) = (1,1,1,0.5) _MainTex (\"Base (RGB)\", 2D) = \"white\" }" +
"SubShader {" +
" Tags { \"Queue\" = \"Transparent\" }" +
" Pass {" +
" Blend One One ZWrite Off ColorMask RGB" +
" Material { Diffuse [_Color] Ambient [_Color] }" +
" Lighting On" +
" SetTexture [_Dummy] { combine primary double, primary }" +
" }" +
"}" +
"}";
The problem is right in the 'Properties' bit - how do I have more than one?
Thanks
Answer by Aras · May 15, 2013 at 04:56 AM
You can't have multiple "Properties" blocks (and this has nothing to do with JavaScript).
A single Properties block is for multiple properties; in fact you already have two properties in your shader (_TintColor and _MainTex).
Thank you, so whats the correct way to write it? Because it keeps throwing an error.
Your answer
Follow this Question
Related Questions
How would I make a shader that gives this appearance? 0 Answers
Why Instantianting material does not copy all properties 1 Answer
How can I edit Material Textures without creating a new Shader?,How to edit Material Texture 1 Answer
It is possible to clone and modify one of the existing shaders 0 Answers
Shader: get back scene pixel color? 1 Answer