Jump to content

How to render cheap fake cloud shadows


Chelaru

Recommended Posts

  • 2 weeks later...

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.

Link to comment
Share on other sites

@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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...