Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (degenerate_762, AbrahamR, AndrewAMD, ozgur), 667 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
A7 Shadow Mapping And Normal Mapping Objects? #175880
01/02/08 12:34
01/02/08 12:34
Joined: Jun 2005
Posts: 656
G
Grafton Offline OP
User
Grafton  Offline OP
User
G

Joined: Jun 2005
Posts: 656
Since the new A7 shadow mapping needs a camera material, ( which overides all other materials in the scene), how can I have other objects that use other shaders with shadow mapping?

I know I could combine normal mapping with the shadow mapping shader, but then it is applied to all objects in the scene! Plus what if I want multitexture shader or several other shaders on different objects?

Anyone know?


Not two, not one.
Re: A7 Shadow Mapping And Normal Mapping Objects? [Re: Grafton] #175881
01/02/08 14:01
01/02/08 14:01
Joined: Jan 2004
Posts: 2,013
The Netherlands
E
Excessus Offline
Expert
Excessus  Offline
Expert
E

Joined: Jan 2004
Posts: 2,013
The Netherlands
There are two ways:

1) render the scene twice (+ 1 time from the light position). One time you render the scene normally, with any shaders you like. The second time you render only the shadows (black and white). Then combine them. If you use this method, it is easy to create soft shadows: just blur the shadow render before combining.

2) Combine the hadow shader with your other shaders. For example, for a normalmapped object you have to create a normalmapping+shadowmapping shader. You can then assign them to all your models individually.

Re: A7 Shadow Mapping And Normal Mapping Objects? [Re: Excessus] #175882
01/02/08 18:44
01/02/08 18:44
Joined: May 2005
Posts: 2,713
Lübeck
Slin Offline
Expert
Slin  Offline
Expert

Joined: May 2005
Posts: 2,713
Lübeck
The first way also allows you to add easily more lights. But to blur it on that way isn´t a good idea since it will cause an halo effect around objects.
For blurring, I can recommend you this paper: http://developer.download.nvidia.com/whitepapers/2007/SDK10/VarianceShadowMapping.pdf
You can have a stronger blur through bluring the lights depthmap. The code can be very easily added to the standart shadowmapping code.

Last edited by Slin; 01/02/08 18:45.
Re: A7 Shadow Mapping And Normal Mapping Objects? [Re: Slin] #175883
01/02/08 21:46
01/02/08 21:46
Joined: Jun 2005
Posts: 656
G
Grafton Offline OP
User
Grafton  Offline OP
User
G

Joined: Jun 2005
Posts: 656
Big Thanks Excessus and Slin!

Excessus, could you please expand on your answer just a little.

In the first method, How can I assure that the scene is rendered in the
correct order (normal mapping -> depth -> shadow)? It seems that this would really cut into the frame rate?

In the second method, If I combine the shaders, say I add normal mapping to the shadowfx material that must be assigned to the camera, How can I individually assign the the normal mapping? It would seem that all scene objects must also
be subject to the normal mapping part of the shader. Or is there a way to individually assign a "shadow mapping + normal" shader to certain objects?

Thanks for the heads up on the VSM light depthmap blurring Slin, Ill check into it.

Really appreciate the help on this, Thanks!


Not two, not one.
Re: A7 Shadow Mapping And Normal Mapping Objects? [Re: Grafton] #175884
01/03/08 10:11
01/03/08 10:11
Joined: Jan 2004
Posts: 2,013
The Netherlands
E
Excessus Offline
Expert
Excessus  Offline
Expert
E

Joined: Jan 2004
Posts: 2,013
The Netherlands
I think you can use the new "stage" feature for determining what views are rendered in order. Never used it though..

About the normalmapping: you can't use a camera material anymore. You have to use ent_next to cycle through all entities and set their shader to whatever you need. You could use a skill to indicate what shader should be used.

Re: A7 Shadow Mapping And Normal Mapping Objects? [Re: Excessus] #175885
01/03/08 12:16
01/03/08 12:16
Joined: Jun 2005
Posts: 656
G
Grafton Offline OP
User
Grafton  Offline OP
User
G

Joined: Jun 2005
Posts: 656
Thanks Excessus,

Alas, From what I understand, the stage feature is only for post processing
effects, re using the "render target" to do full view effects like adding bloom
or blur to shadow mapping.

The A7 shadow mapping "must" use a material on the camera. The manual states
that such a view material "overrides all other material parameters or effects
of all objects in the scene." So I cant normal map a scene object and have
shadow mapping in the same render. And it seems I cant combine all the shaders
I want to use.

Hmmm... ????


Not two, not one.
Re: A7 Shadow Mapping And Normal Mapping Objects? [Re: Grafton] #175886
01/03/08 12:32
01/03/08 12:32
Joined: Jan 2004
Posts: 2,013
The Netherlands
E
Excessus Offline
Expert
Excessus  Offline
Expert
E

Joined: Jan 2004
Posts: 2,013
The Netherlands
Wrong on both counts.

I've looked at the shadowdemo.c from the shader workshops and it uses the stage feature to make the depth view render before the camera view. You could make a larger chain to render depth -> camera -> combine. Combine is basicly a postprocessing effect with 2 input bitmaps.

If you don't set camera.material, no material is overwritte. So just don't set it, and set the appropriate shader for every entity individually. For example, a normal object you give the normal shadow shader, the normalmapped objects are given the normalmap+shadow shader, etc.

Creating a normalmap+shadow shader requires some shader knowledge, but is not very hard. If you take the time to follow the shader workshops, I'm sure you can do it.

Re: A7 Shadow Mapping And Normal Mapping Objects? [Re: Excessus] #175887
01/03/08 21:39
01/03/08 21:39
Joined: Jun 2005
Posts: 656
G
Grafton Offline OP
User
Grafton  Offline OP
User
G

Joined: Jun 2005
Posts: 656
Thanks Excessus!
I have read the workshop, It was the first four well written chapters of your
original tutorial included in the workshop that got me started early on

I think I could combine the normal mapping and shadow.fx files easily enough,
but I havent had any luck assigning Shadow mapping from the workshop to seperate
entities and getting it to work.

I have spent some time already trying to get the normal mapping and shadow
mapping examples from the workshop to work together. No luck yet, but I havent
given up!


Not two, not one.
Re: Dumb question.... :D [Re: Grafton] #175888
01/07/08 18:34
01/07/08 18:34
Joined: Dec 2007
Posts: 17
Mare Offline
Newbie
Mare  Offline
Newbie

Joined: Dec 2007
Posts: 17
Please could someone explain this to me I was reading your posts and if I did it well you were talking about setting a material to a camera.... and having some problems whit that Now can you please tell me how to apply a material to camera, and what version of the gamestudio do I need to do that, because I have tried to simply set camera.material = (some material); and it didnt work..... Thnx


Moderated by  Blink, Hummel, Superku 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1