Author Topic: Implementing shadows(self-shadowing first) in GLSL...  (Read 29286 times)

0 Members and 1 Guest are viewing this topic.

Offline karx11erx

  • 27
  • D2X-XL and DLE-XP coder
    • Descent 2 & D2X-XL
Re: Implementing shadows(self-shadowing first) in GLSL...
I admitted that you'd have a penumbra with a real big light source, but you won't have soft shadow edges in space. Apart from that you cannot prove your point by using the moon as an example, because the target environment is spaceships in space, and probably in quite a distance from a sun. Finally, your sketch is grossly disproportionate. We're talking about 150 million km distance between sun and moon, compared to the sun's diameter of around 1.4 million km and a moon diameter of about 3474 km. What fraction of the moon's size is even the biggest ship from FS or FS2. Your argument imo is completely pointless given the scale of the shadow casters in FS.
« Last Edit: May 06, 2009, 02:00:21 pm by karx11erx »

 

Offline pecenipicek

  • Roast Chicken
  • 211
  • Powered by copious amounts of coffee and nicotine
    • Skype
    • Steam
    • Twitter
    • PeceniPicek's own deviantart page
Re: Implementing shadows(self-shadowing first) in GLSL...
rule of cool my man, rule of cool...


about shadows in space.. -.-


http://thebloatedbrain.files.wordpress.com/2009/01/space-shuttle-challenger.jpg
http://www.spaceline.org/rocketsum/images/bigshuttlechron.gif

take it as you wish, hard shadows first, soft shadows, maaaaybe. :p
Skype: vrganjko
Ho, ho, ho, to the bottle I go
to heal my heart and drown my woe!
Rain may fall and wind may blow,
and many miles be still to go,
but under a tall tree I will lie!

The Apocalypse Project needs YOU! - recruiting info thread.

 

Offline Flipside

  • əp!sd!l£
  • 212
Re: Implementing shadows(self-shadowing first) in GLSL...
If we're going to get scientific about it, that far from the star, you wouldn't get the level of ambient lighting you do in Freespace in the first place, and if there was that level of ambient lighting, then softening on the edge of shadows would be inevitable because light would bleed in from reflected sources.

  

Offline Kolgena

  • 211
Re: Implementing shadows(self-shadowing first) in GLSL...
How about we get any semblance of a shadow first, before we start arguing whether to make it hard or soft? Code whichever one is easier, and tiny details like how fuzzy shadows can be can come later.

 

Offline Flipside

  • əp!sd!l£
  • 212
Re: Implementing shadows(self-shadowing first) in GLSL...
And deny people the right to yell at each other in the name of science for 3 pages? ;)

 

Offline pecenipicek

  • Roast Chicken
  • 211
  • Powered by copious amounts of coffee and nicotine
    • Skype
    • Steam
    • Twitter
    • PeceniPicek's own deviantart page
Re: Implementing shadows(self-shadowing first) in GLSL...
definitely.
Skype: vrganjko
Ho, ho, ho, to the bottle I go
to heal my heart and drown my woe!
Rain may fall and wind may blow,
and many miles be still to go,
but under a tall tree I will lie!

The Apocalypse Project needs YOU! - recruiting info thread.

 

Offline Flipside

  • əp!sd!l£
  • 212
Re: Implementing shadows(self-shadowing first) in GLSL...
On HLP?

 

Offline Angelus

  • 210
  • The Angriest Angel
Re: Implementing shadows(self-shadowing first) in GLSL...
On HLP?

No yelling at each other over science ( physics, etc...) on HLP please, that's what's Game Warden is for...

*checks GenDisc...

...only yelling at each other over religious stuff seems to be allowed...  :nervous:

 :p



 

Offline Flipside

  • əp!sd!l£
  • 212
Re: Implementing shadows(self-shadowing first) in GLSL...
Meh, you should hear the 'there's no sound in space' discussions ;)

Actually, a lot of that religious stuff involves science, since that is the usual 'opposition' to religious viewpoints.

 

Offline Angelus

  • 210
  • The Angriest Angel
Re: Implementing shadows(self-shadowing first) in GLSL...
Meh, you should hear the 'there's no sound in space' discussions ;)

Actually, a lot of that religious stuff involves science, since that is the usual 'opposition' to religious viewpoints.

Yeah, but in that case science is only a tool to disprove arguments on the subject ( religion ), not the subject itself. :)

Ah, i miss the endless debates about physics in real life, movies and games..., maybe i should post a totally absurd assertion and see what happens...   :D




 

Offline pecenipicek

  • Roast Chicken
  • 211
  • Powered by copious amounts of coffee and nicotine
    • Skype
    • Steam
    • Twitter
    • PeceniPicek's own deviantart page
Re: Implementing shadows(self-shadowing first) in GLSL...
Mods, please remove all the unrelated posts....
Skype: vrganjko
Ho, ho, ho, to the bottle I go
to heal my heart and drown my woe!
Rain may fall and wind may blow,
and many miles be still to go,
but under a tall tree I will lie!

The Apocalypse Project needs YOU! - recruiting info thread.

 

Offline Flipside

  • əp!sd!l£
  • 212
Re: Implementing shadows(self-shadowing first) in GLSL...
No. :p

At the moment, we are waiting for news, if the chatter continues when there's actually stuff to discuss, then I'll consider splitting the thread, until then, it's not out of hand, and it is, strangely enough, still remotely connected to the discussion of the behaviour/science of shadows, so it doesn't need to be removed.

Edit : Especially considering it's the grand total of about 3 posts that would even remotely fall into the 'unrelated' category, and one is from me, and another is from you.

 

Offline taylor

  • Super SCP/Linux Guru
  • Moderator
  • 212
    • http://www.icculus.org/~taylor
Re: Implementing shadows(self-shadowing first) in GLSL...
...could you just direct me to the part of the code that deals with depth buffers and in general framebuffers?
There isn't any such section of the code really, not anything that deals with the scene in any way that you need at least.  The FBO code is just the most basic implementation possible, and is coded only so far as to get basic textures from (ie, no depth info).  You could possibly modify the existing FBO code to be used (with even more modifications) to do what you want, but you would probably be better off just duplicating some code and make new functions that deal with proper rendering effects as opposed to just getting 2D textures.  Depending on exactly what method you use to get shadows it might take some rewriting of the model/object rendering code as well to do what you want.

 

Offline pecenipicek

  • Roast Chicken
  • 211
  • Powered by copious amounts of coffee and nicotine
    • Skype
    • Steam
    • Twitter
    • PeceniPicek's own deviantart page
Re: Implementing shadows(self-shadowing first) in GLSL...
i'm gonna delve into this **** now... hopefully i'll have something standalone to show soon...


i just hope i dont crack before i manage to do it.
Skype: vrganjko
Ho, ho, ho, to the bottle I go
to heal my heart and drown my woe!
Rain may fall and wind may blow,
and many miles be still to go,
but under a tall tree I will lie!

The Apocalypse Project needs YOU! - recruiting info thread.

 

Offline Herra Tohtori

  • The Academic
  • 211
  • Bad command or file name
Re: Implementing shadows(self-shadowing first) in GLSL...
I admitted that you'd have a penumbra with a real big light source, but you won't have soft shadow edges in space. Apart from that you cannot prove your point by using the moon as an example, because the target environment is spaceships in space, and probably in quite a distance from a sun. Finally, your sketch is grossly disproportionate. We're talking about 150 million km distance between sun and moon, compared to the sun's diameter of around 1.4 million km and a moon diameter of about 3474 km. What fraction of the moon's size is even the biggest ship from FS or FS2. Your argument imo is completely pointless given the scale of the shadow casters in FS.


No, it isn't pointless. The proportions of the shadow would be pretty much same for a much smaller than Earth object. The lower image was in scale.

With a very simple application of geometry you can calculate the length of the umbra for objects of any diameter. If D is diameter of light source, d is diameter of object, L is distance to the light source and l the length of umbra cone, you get

l = d*L / (D - d)

For objects with d<<D, it can be said that D-d = ~D and therefore approximated that

l =~ d*L / D

Using values

L = 1 AU = 149 598 000 000 metres
D = 1 391 000 000 metres
d = 100 metres

we get umbra length of approximately 10.8 kilometres. That's the distance to the tip of the umbra.

Similarly, the width of penumbra at any given length = l can be calculated by

P = d + ( l [D+d] / L )

Calculating for example with diameter of Sun, distance 1 AU, and penumbra width at 1000 metres behind the object... the penumbra width shows 109.298253 metres.

For example, an object with hundred metres diameter would have an umbra with length of roughly eleven kilometres.  Mind you, that's the distance to the umbra's tip itself; softness to shadows would appear much sooner. For example, at one kilometre from the object, the umbra is roughly 91 metres wide and penumbra is the aforementioned 109 metres. That's an 18 metres wide gradient area at the edge of the shadow.

Considering that for example Colossus is about six kilometres long with that fancy structure in the middle, it could conceivably cast a three kilometres long shadow on itself. That means almost sixty metres of blur on the edge of the shadow already. Very much noticeable compared to sharp edge of a stencil shadow if you're flying next to the ship.

Also, capital ships casting shadows on each other could very well have even longer distances... so no, I don't think it would be waste of effort putting accurate soft shadows in. It would be noticeable in certain situations.


Of course this is all being calculated with a sun with apparent diameter of half a degree... if teh sun is larger, the difference would be even larger. And considering how unfathomably unrealistically big FreeSpace suns tend to be... why not apply the same to the shadows? It's not like realism is the highest authority regarding FreeSpace stuff anyway.

After all, if the shadow code is done right you should be able to specify the apparent diameter of the light source in the mission background editor, or something equivalent. A very small diameter would result in a very stenciley effect, while larger diameter would result in softer edges on the shadows. That way it would be up to mission designer to specify the lighting conditions in this sense; if someone wants sharp shadows and realistically small sun they can do it, while the engine still can do soft shadows in situations where the suns are really big - like in retail FreeSpace campaign, for one good example.

But I feel we're skinning the mammoth before it's taken down here. There are no shadows in the engine yet... and stencil shadow would undoubtedly be simpler to utilize, so I would be more than content with that, at least to begin with. Any shadows would be better than none at all - and I do admit that in vast majority of situations, there would not be perceptible difference between stencil and soft shadows.  :)


...holy scheiber, nine new replies. :eek2:
There are three things that last forever: Abort, Retry, Fail - and the greatest of these is Fail.

 

Offline IceFire

  • GTVI Section 3
  • 212
    • http://www.3dap.com/hlp/hosted/ce
Re: Implementing shadows(self-shadowing first) in GLSL...
Mods, please remove all the unrelated posts....
Got your notification....but I had a read through the post and its pretty much all on topic.  Maybe two or three that I *could* remove but then the subsequent comments make less sense and disrupt the flow of conversation.  They can stay.  If things get really out of hand that would be a different story.
- IceFire
BlackWater Ops, Cold Element
"Burn the land, boil the sea, you can't take the sky from me..."

 

Offline Flipside

  • əp!sd!l£
  • 212
Re: Implementing shadows(self-shadowing first) in GLSL...
That was my opinion too, hence why I decided not to split it yet, if we split out every off-topic comment in every thread, we'd never get anything else done.

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: Implementing shadows(self-shadowing first) in GLSL...
you may still want soft lighting in the nebula and other atmospheric conditions. just because the retail game takes place in space doesnt mean modders wont pull some tricks and come up with something completely different.
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline blackhole

  • Still not over the rainbow
  • 29
  • Destiny can suck it
    • Black Sphere Studios
Re: Implementing shadows(self-shadowing first) in GLSL...
There are soft shadows in space. However there's no way in hell you'll get soft shadows before stencil shadows, so the point is mute. Also, realistic shadows in a nebula would have tons and tons of problems, especially due to the fact that the nebula is lit from all sides, so I would recommend just using very light shadows in that case or you'll die trying to figure out what the heck shadows look like in a nebula.

I would like to mention that the patent application seems ridiculous. I looked at the z-fail situation and was like "WELL OF COURSE IT WORKS IF YOU REVERSE THE DEPTH!" It seems like a painfully obvious thing to me, and this is supported by the fact that one smart dude at id software figured it out on his own, but whatever.

 

Offline karx11erx

  • 27
  • D2X-XL and DLE-XP coder
    • Descent 2 & D2X-XL
Re: Implementing shadows(self-shadowing first) in GLSL...
Harra,

Your kind of over-educated perfectionism kills every advance in a project like this one because it leaves feasibility out of consideration for the sake of covering anything to the greatest extent.

Did you see a penumbra or a soft shadow in the photographs I supplied? I can't remember having seen one in skylab photographs either. Shadow edges look razor sharp there.

But go ahead and code shadows with penumbra and soft borders. Good luck. I am looking forward to what you will come up with. Stencil shadows on the other are easy enough to do (even with penumbras, but not with soft shadowing).

For me this is exaggerated perfectionism turning me off from wanting to help out with this (or smoke, or per pixel lighting with speculars, bump and parallax maps).


blackhole,

No soft shadows w/o diffuse light. No diffuse light with something scattering it. Nothing there to scatter light in empty space. As far as the nebula go: Just because they appear as colorful, dense clouds in a telescope doesn't mean they're like that in space. Afaik they're extremely thin concentrations of glowing plasma or gas, so actually a huge light source themselves, which would mean no shadows in a nebula at all.


So yeah, that's what I could add to FS and FS2:

- A fast particle system creating nice smoke trails for missiles (if you haven't done so already, check out my video in the "Smoke?" thread ;))
- Stencil shadows for space vessels (afaik not patented, and everybody and their dog uses or used it)
- Per pixel lighting, allowing bump or parallax mapping and producing nice speculars on reflective surfaces

What I also have is very fast 3D model rendering code and a means to convert various model formats (POF, OOF, ASE) into it. That code will speed model rendering up by at least a factor of 4 compared to vanilla POF model rendering.

I'm pretty much done with D2X-XL, but using some stuff I have learned while building it in another project seems attractive to me.

On a side note: Do FS/FS2 use FBOs?

karx

« Last Edit: May 07, 2009, 03:32:32 am by karx11erx »