Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
Hi Niko, Since skybox node supports 2 texture layers, is it possible to make Tex1 programmatically "fade out" (get transparent) so that only Tex2 is visible? Then again "fade in" Tex1 so that it completely covers Tex2? Just to make things clear, I'm trying to crossfade one skybox to another. Maybe I could create another skybox node, but I'm not sure how to make one box bigger than another, and how to make its textures transparent on demand. |
||||
|
Could be possible, yes. You could do this either with one skybox and 2 texture layers or 2 skyboxes. In either way, you need to write a pixel shader to fade the texture. for the vertex shader, use something like this (a normal transformation):
And for the pixel shader use something like this (fadeColor is the parameter to how to fade the color)
|
||||
|
I made a shader by modifying your custom material example. It mixes two textures to produce skybox blending, using a uniform variable. The shader works, however the result is not what it should be. Seems that Skybox node doesn't pass the second texture to the shader. To make things clear, for each side of the skybox I load 2 textures, like this: for (var i = 0; i < 6; i++) { this.skybox.getMaterial(i).Tex1 = texMan.getTexture (this.getFileName1(i), true); this.skybox.getMaterial(i).Tex2 = texMan.getTexture (this.getFileName2(i), true); this.skybox.getMaterial(i).Type = this.customMaterialType; } My skybox in total has 12 textures (6 sides, each with Tex1 and Tex2). The shader works, but the Tex2 is always empty, meaning it's never passed to the shader stage, so the blending doesn't work. |
|