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.

DarkBASIC Professional Discussion / evolved's light scattering effect is not visible

Author
Message
mr Handy
18
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 28th Apr 2012 15:27 Edited at: 28th Apr 2012 15:29
Hi, here is the ORIGINAL demo, without changes. Effect is not visible, shader has no errors. I've tried to fix it but obviously unsuccessfully. Could somebody test it?

«It's the Shader, shader me this, shader me that»
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 28th Apr 2012 15:33 Edited at: 28th Apr 2012 15:34
Works fine here:



You will need a GFX card that supports PS1, PS2 and PS3.
mr Handy
18
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 28th Apr 2012 16:35 Edited at: 28th Apr 2012 16:39

I have modern card - HD4770... weird. Strange thing is that I can't see plain even without effect! return float4(1,1,1,1) doesn't work either!!!

Maybe code contains some extra shader stuff that not all cards can support? Like in STALKER 2 I can't see wire mesh (because of developer's retardness), but other people can.

«It's the Shader, shader me this, shader me that»
Morcilla
23
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 28th Apr 2012 18:10
I'm afraid it doesn't work here either
Using ATI Radeon as well, but this is the 1st thing that I do not see working, uh.

mr Handy
18
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 28th Apr 2012 18:31 Edited at: 28th Apr 2012 18:32
IMHO quad is somehow out of sight -> shader vs part

«It's the Shader, shader me this, shader me that»
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 28th Apr 2012 18:49 Edited at: 28th Apr 2012 18:53
It's a nice shader. You could probably make an alpha plain that looks similar. In fact, I'm going to make one, because I'm bored.

Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 28th Apr 2012 19:24
I'm not sure if these will be exactly right, but try them out, and maybe show me where they are not working properly. DOWNLOAD...

mr Handy
18
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 28th Apr 2012 19:26
what's this?

«It's the Shader, shader me this, shader me that»
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 28th Apr 2012 19:32 Edited at: 28th Apr 2012 19:34
Oops! Forgot to make them transparent... try this DOWNLOAD..

These are transparent textures to add to a plain to make rays with. If you add a vector between the sun, and the camera you can switch the rays on when the vector is spliced.

mr Handy
18
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 28th Apr 2012 19:49
So you mean to use this fake instaed of shader (also fake, lol)? I think your rays is good looking and I'll try them later, but now I want to know why this stupid shader don't work.

«It's the Shader, shader me this, shader me that»
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 28th Apr 2012 20:00
Yeah, I figure if you make a game with a shader that doesn't work you may as well make a manual one. At least it will work on all computers. It doesn't matter if you don't use it, I was bored anyway. The edges of my textures need to blend into the background, and so they will need editing once I see them on a screen. I'm pretty sure that I have some square edges at the moment.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 28th Apr 2012 22:43
Quote: "but now I want to know why this stupid shader don't work."


Does your card support PS1? If you're not sure try changing all the references to ps1 to ps2_0_0 in the shaders and similarly for any vs1 references in the compile targets in the technique parts.
Scraggle
Moderator
22
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 28th Apr 2012 22:51
Disappointed to learn that the iMac's graphic card doesn't display the shader either
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 28th Apr 2012 23:19
It's called progress.

There must be a simple explanation to all this. Do you know whether your card supports both PS1 and PS3? (I don't know of any modern cards that don't support PS2.)
Stab in the Dark software
Valued Member
23
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 29th Apr 2012 04:52 Edited at: 29th Apr 2012 04:54
The light scattering Shader is not working for me.
I am testing on ATI Fire Pro V4800.
I will test on my Nvidia machine tomorrow.


[img][/img]


WindowsXP SP3,Vista,Windows 7 SP1, DBpro v7.7RC7
Stab In The Dark Editor
The coffee is lovely dark and deep,and I have code to write before I sleep.
mr Handy
18
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 29th Apr 2012 11:12 Edited at: 29th Apr 2012 11:14
Quote: "Does your card support PS1? If you're not sure try changing all the references to ps1 to ps2_0_0 in the shaders and similarly for any vs1 references in the compile targets in the technique parts."

It works! As ps 3_0 vs 3_0. That's very odd - 2_0 has less stuff than 3_0, and you've run it! What's your card?

edit: other two shaders works fine with 1_0 and 1_4 shader models!

«It's the Shader, shader me this, shader me that»
Morcilla
23
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 29th Apr 2012 11:57 Edited at: 29th Apr 2012 11:59
Yes it works here as well if I set 3.0 PS/VS:



@GG, does that still work fine in your computer too? It would be nice to know if the solution doesn't broke anything for somebody else

[Edit: Only needed to set 'Scatter.fx' to 3.0, and the other two shaders, 'EnvironmentBump.fx', 'SkyBox.fx', to 2.0]

Morcilla
23
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 29th Apr 2012 12:52
Now that we have it working I would like to take the chance to dig into this shader, 'Scatter.fx'.

How can we use it into our programs?

In the shader code I see we must supply the light direction:



But I also see the Projection Matrix is hardcoded:



I've tried:



But then the effect doesn't show properly, the light seems to come from the wrong direction.

Please GG, could we work on this subject?

mr Handy
18
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 29th Apr 2012 14:10
look here for info
http://robertokoci.com/world-view-projection-matrix-unveiled/

«It's the Shader, shader me this, shader me that»
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 29th Apr 2012 17:40
Quote: "@GG, does that still work fine in your computer too? It would be nice to know if the solution doesn't broke anything for somebody else "


Yes, that change works for me. Don't know about anyone else though.

Some GFX cards are rather picky about these details.
Morcilla
23
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 29th Apr 2012 18:31
That's great
Any clue about getting the shader 'out of the box'?

Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 29th Apr 2012 20:50 Edited at: 29th Apr 2012 20:50
Only works for me as well if I set 3.0 PS/VS. It's a good effect.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 30th Apr 2012 00:15
@Morcilla

Only just spotted this. Sorry:

Quote: "But then the effect doesn't show properly, the light seems to come from the wrong direction.

Please GG, could we work on this subject?"


I'll look at that tomorrow. My brain has had enough of projections for one day.
Morcilla
23
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 30th Apr 2012 17:45
Hey thanks, I'll stay tuned.
It doesn't seems too complicated but I wonder what else needs to be done to change the light direction

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 30th Apr 2012 19:17 Edited at: 30th Apr 2012 19:18
I guess you'd need to change a few things.

For example the environment cube map has the sun in a fixed position. Here's the relevant face of the cube map:

Morcilla
23
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 30th Apr 2012 20:57 Edited at: 30th Apr 2012 20:59
Sorry I do not see that the cubemap is needed.

The cubemap is used for texturing the main object that cast the scattering, but it is not used by the scattering shader itself.

For example, in the DBPro code, I can change the cubemap,



for this other, 2d texture:



And the scattering shader keeps on working.


I managed to change the ligt position to come from the X axis.
What I've done:

- In DBPro, feed the light position tweak variable in the shader, something like:



- Update the sun plain to point in the light direction, as this is used in the shader texture, something like:



And that should be it, but as said before, the Projection Matrix is hardcoded in the shader, and I cannot change it, if I change it, the effect cast the scattering in the wrong direction.
It shows:



And I supposed it to be changed for:



But I better don't do that
Dunno what that ProjMat is doing but it seems it must not be changed, uh

So, problem solved, at least so far. I'll let you know if I encounter any other issues.
Many thanks!

Oh and if get through it, I'll post the results, this must be spectacular. Thanks again!

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 30th Apr 2012 22:16
Quote: "Sorry I do not see that the cubemap is needed."


It isn't - but it is one of the things you'd need to change as you say.
Morcilla
23
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 1st May 2012 13:25
Well, the "Black" technique int the EnvironmentBump.fx effect must be incorporated somehow to any shader applied to the casting object, which in my case should be the planetary and planetary rings shaders.
As said, I think I should give this a try because of the visual improvement result itself. A little challenge ahead

Morcilla
23
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 3rd May 2012 18:48 Edited at: 3rd May 2012 18:48
I'm having a little issue with the plane creation.

In the DBPro code, it uses the extra parameter 'Orientation' (,1 at the end):



Now, DGDK has this parameter missing, and I cannot reproduce its behaviour, the shader looks wrong

I know that the extra parameter is supposed to make the plain orientation to be faced to the camera, I've tried:



but the shader doesn't look the same.

Does anyone know how to mimic the behaviour of the 'make object plain' extra parameter 'Orientation'?

Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 3rd May 2012 20:44 Edited at: 3rd May 2012 20:47
Well point object would work if you mess around with Camera x(), camera y()-?, camera z(). You need to do something with the Y value to get the perspective right.

By the way, your space sim looks great.

Morcilla
23
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 3rd May 2012 21:15 Edited at: 6th May 2012 17:23
Thanks Pincho, I just figured it out by looking at the DGDK version that Evolved made
I didn't remember I had the code around

It seems that



is the same as



And yet, something is preventing the shader from showing inside the big project, uh
Oh well it couldn't be any other way
[Edit: typo]

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 4th May 2012 17:33
I'm sure there's a simple fix for this issue with plains and shaders. If you don't get it sorted out easily just remind me in a day or so (a bit busy right now).
Morcilla
23
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 6th May 2012 17:21
Hey thank you, I got it working yesterday. Main problem was that this shader needs a short near camera range to see the plane with the effect. Max value for near camera range in this set up is 3.5 and I had 5.0
Here is how it looks:



It looks nice
However, I've tried to change the shader, because the current one adds brightness to the scene.
The current approach adds a white ghosted layer and then subtracts the shadow beams.

I would rather have those shadow streaks to be subtracted from the original scene, keeping also the bright sun beams if possible.

With the current shader, the scene gains in brightness and the Sun becomes oversized, and I don't want to increase the angular size of the Sun, that already gets bigger with the flares and the HDR.

Oh well, I guess it is part of the effect. With non aditive ghosting the result is less spectacular, and probably it would need a totally different approach.

Anyway this is what I've tried. Maybe someone can provide an alternative, because the scene becomes kind of dull.
My testings are in the pixel shader:



If you want to play, just replace the original 'Scatter.fx' shader with this test one:



So far, I'll keep using the original shader and I'll try to dynamically adjust the 'Decay' parameter at run time, so it doesn't add too much brightness, but any other suggestions are appreciated

Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 6th May 2012 17:44 Edited at: 6th May 2012 17:47
Could you not work out the scale to shrink your sun size down to get it back to what is was before? So use a smaller sun than you used originally. I'm currently working on a space game as well, and am happy to get any useful code. I want to cut my production time down, but I have to learn rigging, and ZBrush, and lots of thing that push my production time into many months.

Morcilla
23
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 7th May 2012 17:57
Hey thanks for the idea, I'll think about it

Login to post a reply

Server time is: 2026-07-08 03:47:43
Your offset time is: 2026-07-08 03:47:43