Kweihsi Ku Posted November 13, 2015 Share Posted November 13, 2015 I followed the render to texture discussion with the example of depth buffer. And I set the alpha channel in the fragment shader to zero. But the spheres the plane is not transparent at all. I have set needAlphaBlending to true. Am I missing anything? http://www.babylonjs-playground.com/#EEOWP#1 Quote Link to comment Share on other sites More sharing options...
RaananW Posted November 13, 2015 Share Posted November 13, 2015 you can set the visibility of the plane using plane.visibility (line 49). Is that what you were looking for? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 13, 2015 Share Posted November 13, 2015 Hello the trick is to use the renderTarget in the opacityTexture channel (because emissiveTexture is not used for alpha):http://www.babylonjs-playground.com/#EEOWP#3 Quote Link to comment Share on other sites More sharing options...
RaananW Posted November 13, 2015 Share Posted November 13, 2015 Oh. That's a nice trick :-) Quote Link to comment Share on other sites More sharing options...
Kweihsi Ku Posted November 13, 2015 Author Share Posted November 13, 2015 That is what exactly I need. I am plan to implement fog of war effect by put this texture as a layer of the camera. GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Kweihsi Ku Posted November 14, 2015 Author Share Posted November 14, 2015 I do have another follow up question. After making "holes" in the fog, I do not wanna render those spheres in the main scene. I try to set isVisible true before rendering to texture and false after. I create another sphere2 for testing the holes. But it seems not working. http://www.babylonjs-playground.com/#EEOWP#5 Quote Link to comment Share on other sites More sharing options...
Kweihsi Ku Posted November 14, 2015 Author Share Posted November 14, 2015 According to the discussion here. Object must be visible all the time for rendertargettexture.http://www.html5gamedevs.com/topic/13053-scene-compositing-problems/ I hack it by move the spheres away. So they are "hidden" behind something I need to render. http://www.babylonjs-playground.com/#EEOWP#7 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 15, 2015 Share Posted November 15, 2015 Sounds good! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.