Lightmap and AlphaChannel for a material.
Lightmap and AlphaChannel for a material.
I am exploring lightmap possibilities for my scene. Currently the lightmapping works fine, but in my scene there are certain 2D textures such as trees. Such textures need to be transparent. But how do I set a material as transparent but still be able to use lightmap?
thanks, but unfortunately i dont have much time to first learn and then use a solution as I have only couple of weeks left.
but i am wondering if there is anybody here who has been facing this problem and may have found a solution....
Edit: Is there any other method by which I can display a material transparently without setting the material flag?
but i am wondering if there is anybody here who has been facing this problem and may have found a solution....
Edit: Is there any other method by which I can display a material transparently without setting the material flag?
http://www.clockworkcoders.com/oglsl/tutorial7.htm
This may be something of the nature you are looking for.
Not to suggest that internal shading is the only POSSIBLE way to do it, but I can't say.
This may be something of the nature you are looking for.
Not to suggest that internal shading is the only POSSIBLE way to do it, but I can't say.
Sorry it took so long. My dad's just gotten home from the hospital, and I was getting really, really sick of trying to figure this out, but I had the same problem.
Still, you are correct. I solved the problem for me with this glorious line of code:
Notice the EMT_TRANSPARENT_ALPHA_CHANNEL cast, just as if you were using this as a parameter is SetMaterialType.
You are correct that link is GLSL, the openGL highlevel shader.
BlendFunc = source * sourceFactor + dest * destFactor ( E_BLEND_FUNC ) Using only Textures[0]. generic Blender
is the description for EMT_ONETEXTURE_BLEND.
I'm not exactly sure what you mean by referencing this material. In my openGL implementation I achieved this by
gl_FragColor.argb = texval1.argb*0.5 + texval2.argb*0.5
whereas .5 is simply the weight making it a true adverage (texval1.argb +
texval1.argb)/2.0 is the same thing. As you can see, I actually passed the textures, but, speaking from theory as I may be I do not believe you have to do this for a single texture, although I know none of the DirectX shader langauge.
If you have any more questions, such as how to pass a texture, please ask.
I Hope I'm getting the hang of this. I don't fully grasp everything in the materials world mysyelf, I'm sure.
I'm not directly sure how you might set the Alpha directly after using the blend material from IrrLicht, no, but as you can see, mapping the output similairly in the shader should not be terribly difficult (I think). Still, I'm not even sure to implement the blend thing in Irr itself, so I'm not very enlightened. Mabye you could simply cast it from the AddHighLevelShader call?
I hope I'[/code]
Still, you are correct. I solved the problem for me with this glorious line of code:
Code: Select all
newMaterialType1 = gpu->addHighLevelShaderMaterial(vertShader, "main", video::EVST_VS_1_1,pixelShader,"main",EPST_PS_1_1,callback,video::EMT_TRANSPARENT_ALPHA_CHANNEL); You are correct that link is GLSL, the openGL highlevel shader.
BlendFunc = source * sourceFactor + dest * destFactor ( E_BLEND_FUNC ) Using only Textures[0]. generic Blender
is the description for EMT_ONETEXTURE_BLEND.
I'm not exactly sure what you mean by referencing this material. In my openGL implementation I achieved this by
gl_FragColor.argb = texval1.argb*0.5 + texval2.argb*0.5
whereas .5 is simply the weight making it a true adverage (texval1.argb +
texval1.argb)/2.0 is the same thing. As you can see, I actually passed the textures, but, speaking from theory as I may be I do not believe you have to do this for a single texture, although I know none of the DirectX shader langauge.
If you have any more questions, such as how to pass a texture, please ask.
I Hope I'm getting the hang of this. I don't fully grasp everything in the materials world mysyelf, I'm sure.
I'm not directly sure how you might set the Alpha directly after using the blend material from IrrLicht, no, but as you can see, mapping the output similairly in the shader should not be terribly difficult (I think). Still, I'm not even sure to implement the blend thing in Irr itself, so I'm not very enlightened. Mabye you could simply cast it from the AddHighLevelShader call?
I hope I'[/code]