Jump to content

Recommended Posts

Posted

Here's something I've never mastered.  How to get my large voxel terrain to cast shadows onto itself?  At the very least I want nearby mountains to cast shadows.  Is this a separate pass done in a specific shader?  Or some highly advanced custom code I need to write?

Posted

Well if I actually created a light it might help, eh?

void Atmosphere::CreateSun()
{
	//light_sun = CreateDirectionalLight(world);
	//light_sun->SetRotation(45, 35, 0, true);
}

My dark patch friends are back with the light but no shadows.  Shadows would need valid UV coords yeah?

Shadows_002.thumb.png.71d9872c7be6013734d9b830a1513df3.png

Posted
14 minutes ago, SpiderPig said:

Shadows would need valid UV coords yeah?

No

  • Thanks 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Posted

Call world::SetIblIntensity(0) to get rid of the PBR lighting so you can see what's going on better.

  • Like 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Posted

You can also save your model as a GLTF and view it in another program to make sure there's nothing strange going on.

  • Thanks 1

My job is to make tools you love, with the features you want, and performance you can't live without.

  • 1 month later...
Posted

Shadows are being cast properly now.  :D  However the player and terrain don't have shadows... I think it might be due to both have pivots as a parent somewhere down the line... I will test this.

pivot->SetShadows(true)

;)

Shadows_005.thumb.jpg.5e91b2924b5caa47ded1bfa64cff8f05.jpg

Posted

The terrain does have shadows now but what I really want to do is have terrain shadows far into the distance.  Ideally the whole terrain casts shadows at least onto itself at a low resolution if required.  Is this something that can be done with shaders and an extra camera?

Posted

I suppose you could create a second camera and another directional light, but the performance will probably not be good. Maybe use a single box light instead.

A baked lightmap for distance terrain shadows is something I have thought about.

  • Thanks 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Posted

That actually gives me an idea.  I suppose I could create a series of low resolution shadow maps and use a shader to blend between them depending on the light direction.  Or even a compute shader to calculate the shadow map on the fly.  🤔

  • 1 month later...

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.

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