Chelaru Posted November 16, 2016 Share Posted November 16, 2016 The following blog shows how to implement a cheap way of creating cloud shadows on the ground.http://jbrd.github.io/2009/10/18/very-cheap-fake-cloud-shadows.html Quote Link to comment Share on other sites More sharing options...
JeffR Posted November 18, 2016 Share Posted November 18, 2016 Hey, that's pretty slick!Nice find. Quote Link to comment Share on other sites More sharing options...
Chelaru Posted November 18, 2016 Author Share Posted November 18, 2016 Hey, that's pretty slick!Nice find. This might be the most annoying questions ever: Do you know how to implement this ? Quote Link to comment Share on other sites More sharing options...
JeffR Posted November 28, 2016 Share Posted November 28, 2016 Haha, no worries.You'd add this to the shader code for the terrain block class. The shader addition itself isn't hard, of course, but you'd also need to add in the grayscale texture to pass in from the C++ code as a shader const handle, as well as the time delta float they mention to make it scroll.I'd suggest starting by looking at the terrRender files and finding how it handles the setup and binding of the shaderConst handles. Those are basically the connection between the C++ object and the shader and how you'd pass stuff to the shader.But the idea being you'd add a new texture2D handle for that 2x2 grayscale image they mention, and a float handle for the fCloudOffset he mentions. Then during the terrain render function, you'd just increment the fCloudOffset. Then you'd add the snippet from the page to the vertex shader for the terrain as well as the texture2d and float from above so the snippet can actually have the data to work with. Quote Link to comment Share on other sites More sharing options...
Duion Posted November 28, 2016 Share Posted November 28, 2016 Would those cloud shadows match the real clouds? Since Torque also uses a simple texture to display the clouds. Quote Link to comment Share on other sites More sharing options...
LukasPJ Posted November 28, 2016 Share Posted November 28, 2016 Instead of adding a Tex2D, wouldn't it be doable with just a float4?Edit: Also, just adding it to the terrain, would not affect shadows on other objects, might look a bit weird with a shiny house in a dark cloud shadow Quote Link to comment Share on other sites More sharing options...
Duion Posted November 28, 2016 Share Posted November 28, 2016 Hm why not just make the clouds texture cast shadows? Casting shadows for other alpha textures works fine as well, so why not for clouds? Quote Link to comment Share on other sites More sharing options...
LukasPJ Posted November 29, 2016 Share Posted November 29, 2016 @Duion I think the issue is that clouds are a post-process and therefore they don't really exist enough to cast shadows.. For example, even if we could do that, the clouds would only exist where you could see them, thus they would disappear when you were looking at the ground, which would make for some weird shadows. So casting shadows from the clouds is more advanced than that, not saying impossible, but definitely not as cheap. 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.