Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Simple Shadows Help - Shader Experts

Author
Message
Cetobasilius
14
Years of Service
User Offline
Joined: 29th Dec 2009
Location: Mexico
Posted: 7th Feb 2011 14:08
Hi there. I searched and worked all day today trying to get shadows to work, i tried Mistas converted examples and Paulis examples too. evolved shadow mapping works fine, however i do not want to use normal maps, Paulis Shader with 3 lights works fine when i use it with animated 3D models, they cast a shadow ok on a primitive and over themselves, now, i tried moving this example to my game and it was a mess. if i change camera 1 to another it wont cast shadows, and some other things. Also, i use .dbo files for my levels/maps, and these contain lightmapping, however, i would like to discard the lightmapping part and have some dynamic lights. Also for the game characters to cast a shadow on the level, i tried like 5 examples mista provided and like 3 of pauli, only one using simple shadows, can someone point me in the right direction for a simple shadow shader file? im starting to learn HLSL but i dont think i will be learning it very soon by the looks of it. Please, help me.. i can provide an example .dbo(level)file and a .x(character)animated file and their textures.

hi
_Pauli_
AGK Developer
15
Years of Service
User Offline
Joined: 13th Aug 2009
Location: Germany
Posted: 7th Feb 2011 14:52
So let me make sure I understand what you want:

- Shadow casted from one light
- No normal mapping
- No light mapping

A bit of code would certainly help here. Maybe you should read up on Shadow Mapping (the technique I use) somewhere like here.

Now the plot thickens, the fps decreases, and the awesomeness goes through the roof.
Cetobasilius
14
Years of Service
User Offline
Joined: 29th Dec 2009
Location: Mexico
Posted: 8th Feb 2011 07:34 Edited at: 8th Feb 2011 09:14
Pauli! Its great you saw this. i will start there. i used your spotlight3.fx and thats nearest to what i need. but exactly what i need is

-shadows casted by one or more lights(dont mind if i can have more)
-no normal mapping
-no lightmapping but .dbo files might become a mess because of this.
(i make .dbo files out of 3dWorld studio).

lol i actually tried replying about 12 hours ago but forgot to click "post message"

the problems i had with your fx file, were that i have a fullscreen shader and was using camera 1 for it. if i change your shader file camera it doesnt work properly, how does it control the camera without calling anything to control it? i will have to do my HLSL homework too i bet. but its really great to have all these examples to work with.


EDIT: When i load the .dbo model and apply the effect, it looses all of its textures. is there a way to use normal maps with .dbo files? i also tried to use darkgdk built in shader support, and i got it to work with primitives, but freezes when i try to load a complex model and turn the shading on. i guess maybe i will have to use normal maps on my levels. will have to find another option to make them though. Any suggestions?

hi
Coldfire
16
Years of Service
User Offline
Joined: 22nd Oct 2008
Location: Indiana
Posted: 8th Feb 2011 15:10 Edited at: 8th Feb 2011 15:16
It's been a while since I've messed with shaders in DBP or GDK, but I'm fairly certain what you need to do is set the objects second texture stage. In DBP it's something like this(note: haven't tested):



I think thats a safe bet since I have never came across a normal mapping shader that doesn't use the second stage for the normal map. Not saying there aren't any, but I've never seen any. As far as I can tell, all of these commands are supported in GDK, albeit slightly different syntax, but I'm sure you know the drill

Hope this helps!

Randy

Oh, and as for making normal maps, If you are familiar with The GIMP, there is an excellent normal mapping plugin that lets you use a grayscale image for generating simple normal maps. A google search for "gimp normal map plugin" should locate that. If you are wanting to make normal maps from 3d objects, however, you will need to learn retopology techniques. I know many that have suggested ZBrush, but I have never used it myself.

Edited some typos
_Pauli_
AGK Developer
15
Years of Service
User Offline
Joined: 13th Aug 2009
Location: Germany
Posted: 8th Feb 2011 22:36 Edited at: 8th Feb 2011 22:39
@Coldfire:
Quote: "-no normal mapping"


@Cetobasilus: Here's what you can do:
Have a look at this thread. Check out the code snippet of the whole demo in the 3rd post.

This part is very important:



The thing to note here are the two dbSyncMask() commands. They switch which camera is synced to create two visual versions of the scene (the depth image and the final scene). You have to pass the right camera ID (the lights view camera and the users camera) to this function as parameter. But unfortunatly it's not as simple as passing just the camera ID as integer... You should use this makro:



And do it like this:



Another thing to take care of is the matrix and vector stuff.

Now the plot thickens, the fps decreases, and the awesomeness goes through the roof.
Cetobasilius
14
Years of Service
User Offline
Joined: 29th Dec 2009
Location: Mexico
Posted: 8th Feb 2011 23:12
@_Pauli_ ok thats great! i messed with that same snippet and got it to work somehow with .x fles. got some minor problems, but i think i will go with the shadows with normal maps, which is in another post you made. great work on these achievments. With some things cleared out i think i can continue my Shadow Shading quest lol. will continue reading and practicing shaders.

@Coldfire Thanks for the plugin sugestion! will be sure to check it out.

hi
Coldfire
16
Years of Service
User Offline
Joined: 22nd Oct 2008
Location: Indiana
Posted: 9th Feb 2011 00:54 Edited at: 9th Feb 2011 00:55
I was actually referring to his edit:

Quote: " is there a way to use normal maps with .dbo files?"


I probably could have specified that though

Login to post a reply

Server time is: 2024-11-19 14:45:35
Your offset time is: 2024-11-19 14:45:35