About Store Forum Documentation Contact



Post Reply 
Individual shadow control
Author Message
sydbod Offline
Member

Post: #1
Individual shadow control
Greetings,

How does one turn ON/OFF the shadow creation for selected individual objects?

Thanks Syd :oops:
06-29-2009 10:38 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
Re: Individual shadow control
Hi,

if you don't want an object to cast shadows, then don't render it in the RM_SHD_MAP rendering mode

Code:
struct CustomClass : ..
{
  virtual void draw()
  {
      if(Renderer()!=RM_SHD_MAP)__super::draw()
  }
}
06-29-2009 01:13 PM
Find all posts by this user Quote this message in a reply
sydbod Offline
Member

Post: #3
Re: Individual shadow control
Thank you, and congratulations on a first class game library.
Not that it means much, but I am greatly impressed. smile
06-29-2009 01:55 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
Re: Individual shadow control
thanks smile
06-29-2009 02:19 PM
Find all posts by this user Quote this message in a reply
sydbod Offline
Member

Post: #5
Re: Individual shadow control
One more question about shadows.

This is for a flight sim project, that I am doing preliminary testing for.

ViewportFull.range=100000;// require visibility of at least 100KM

I have to create shadows for aircraft when they come below 100M to the ground or water, and when they are closer than 1KM to the camera.

Shadow mapping over such a huge area just does not work.

I have tried stencil shadow creation, to test it out., but I must be doing something wrong.

D.shdMode(SHD_STENCIL); is in the "void InitPre()".
case (RM_SHD_STENCIL): with the object to cast the shadow under this, inside the "void Render()" function.

There is an active Sun , so I assume no other light source is required.

What am I doing wrong? Or is there a sample code dealing with stencil shadow creation?

Thanks Syd. smile

EDIT: OK found the problem, should be using "Mesh::drawStencilShadow()".
It appears to be broken though:
[Image: ad34707d.jpg]
06-29-2009 07:16 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #6
Re: Individual shadow control
Hi smile

please check tutorial "demo/lights" if I remember correctly there is presented how to use stencil shadows (besides calling 'drawStencilShadow' in RM_SHD_STENCIL) you need to create a separate mesh for the stencil shadows only (it's in the tutorial)

altough stencil shadows are generally not recommended (world terrain isn't compatible with stencil shadows, unless of course you'll render your terrain manually)

shadow maps are recommended.
you can increase their resolution with D.shdMapSize
06-30-2009 03:17 PM
Find all posts by this user Quote this message in a reply
sydbod Offline
Member

Post: #7
Re: Individual shadow control
Thanks for the info about the sample.

I did try "D.shdMapNum(6);" with "D.shdMapSize(4096);". Both are at their max setting.
Each pixel of the shadowmap is about the same size as the aircraft that I will be trying to create the shadow for. With "ViewportFull.range=100000;// require visibility of at least 100KM", shadow map is not a workable solution unless there is some way of confining the shadow map to cover a small area around 0,0,0 and having the players point of view transposed to the origin with the 3D world transposed accordingly.

I shall also have to look into creating 2 cameras , one with shadow map and covering a very small view distance, the other covering anything further away than the range of the first camera but not having a shadow map. (I just don't know if the water renderer will have any problems with this, I can only try)

Syd smile

EDIT: yes each island will be made up of its own 3D model as creating them with a mesh is just too wasteful.
06-30-2009 04:33 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #8
Re: Individual shadow control
Oh, I forgot about one important feature that may help you grin
please check - D.shdFrac (it limits the shadowing range to a fraction of the visible range), it should be the thing that you need.

try setting D.shdFrac(0.1) or less
06-30-2009 04:40 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #9
Re: Individual shadow control
you can take a look at D.shdFade too
06-30-2009 04:41 PM
Find all posts by this user Quote this message in a reply
sydbod Offline
Member

Post: #10
Re: Individual shadow control
You are a GOD :shock:

I think you may have just solved my problem with D.shdFrac().

D.shdFade() is another function I had no idea even existed.

This has to be the best game library that I have ever seen. The ONLY thing currently letting it down is the lack of a simple documentation of its functions. I suppose this will be taken care of when you happen to have free time. It is great that you have so many samples to demonstrate the various features.

Again, thanks for all the help. smile
06-30-2009 05:19 PM
Find all posts by this user Quote this message in a reply
Post Reply