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

0 Members and 1 Guest are viewing this topic.

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Implementing shadows(self-shadowing first) in GLSL...
Calm down karx11erx. HT has already said more than a couple of times that he considers stencilled shadows a huge improvement on the current code. And I doubt he'd complain much if the game code never went beyond that.

You have to differentiate between the scientific argument and the what should be done to the game engine argument. 
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline Herra Tohtori

  • The Academic
  • 211
  • Bad command or file name
Re: Implementing shadows(self-shadowing first) in GLSL...
What he said.

Stencilled shadows would be awesome, soft shadow possibility even better, and considering there are quite a few mods that involve or are planning to involve atmospheric missions (Shadows of Lylat, 158th Banshee Squadron, probably Diaspora, even retail FreeSpace 2 nebula missions) it wouldn't be wasted effort. Just possibly excessively awesome considering the implementation of soft shadows would also work if you wanted stenciled shadows, but stencil shadows wouldn't work if you wanted to have soft shadows.

And like you would have noticed if you read my messages thoroughly, the shadow edges on the photographs of our space ships don't show soft shadows, because the spacecrafts are so small and distances so short that it really doesn't start showing on the photographs. Self shadowing of fighter/bomber sized ships would look pretty much like stenciled shadows for obvious reasons, but remember that an Ursa is already larger than the Space Shuttle Orbiter, and we haven't built six kilometres long warships so showing images of Skylab or the Orbiter isn't really relevant on how shadows would look on that kind of behemoths...

Also, regarding perfectionism, I refer you to my recently aquired user title. :p I do think that if possible, modeling things as accurately as possible will be more beneficial in the long run, even if technically easier but more crude way would suffice for current purposes. That's why I think that if feasible, soft shadows wouldn't be wasted effort. If it's not feasible, then stencil shadows are just fine and dandy. But I am not a coder so I wouldn't know how much more difficult it would be to make the shadow geometry realistically defined by the apparent diameter of light source. Probably a lot. :D

Stencil shadows with ambient occlusion would probably make me defecate ceramic building materials right there, I don't know what soft shadows would do... :lol:
There are three things that last forever: Abort, Retry, Fail - and the greatest of these is Fail.

 

Offline blackhole

  • Still not over the rainbow
  • 29
  • Destiny can suck it
    • Black Sphere Studios
Re: Implementing shadows(self-shadowing first) in GLSL...
Quote
No soft shadows w/o diffuse light.

Fine :C

Quote
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.

Quite true. However, FS2 doesn't care what they're supposed to be like.

Quote
I do think that if possible, modeling things as accurately as possible will be more beneficial in the long run

Not in programming. Rendering something with stencil shadows and rendering something with soft shadows requires 2 very different approaches.

 

Offline Herra Tohtori

  • The Academic
  • 211
  • Bad command or file name
Re: Implementing shadows(self-shadowing first) in GLSL...
Quote
I do think that if possible, modeling things as accurately as possible will be more beneficial in the long run

Not in programming. Rendering something with stencil shadows and rendering something with soft shadows requires 2 very different approaches.


Hence the disclaimer "if feasible".
There are three things that last forever: Abort, Retry, Fail - and the greatest of these is Fail.

 

Offline karx11erx

  • 27
  • D2X-XL and DLE-XP coder
    • Descent 2 & D2X-XL
Re: Implementing shadows(self-shadowing first) in GLSL...
Calm down karx11erx.
I would sound pretty different if I wasn't calm. Let's just say that I occasionally tend to express my opinions in a rather pointed way. Don't over-interprete it. ;)

Also, regarding perfectionism, I refer you to my recently aquired user title. :p
Yeah, I had noticed it and have had my thoughts about it already. :P

Stencil shadows are cheap performance wise, particularly in an environment as FS with no static geometry (only objects). Soft shadows are costly. Depends on what class of machines you want to be able to have shadows on ... ;7
« Last Edit: May 07, 2009, 05:00:02 am by karx11erx »

 

Offline pecenipicek

  • Roast Chicken
  • 211
  • Powered by copious amounts of coffee and nicotine
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • PeceniPicek's own deviantart page
Re: Implementing shadows(self-shadowing first) in GLSL...
karx11erx, want to help out with implementing the damn thing then?



as for my understanding of soft vs stencil only, its hard to get the former without the latter :p


also, soft shadows can be made via shaders, taking the data stencil shadows give and fuzzyfying the edges with the likes of gaussian blur and stuff. (probably not exactly gaussian blur, but you get the idea....) i think.
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 karx11erx

  • 27
  • D2X-XL and DLE-XP coder
    • Descent 2 & D2X-XL
Re: Implementing shadows(self-shadowing first) in GLSL...
Provided FS(2) is using FBOs as render targets, making soft shadows from stencil shadows and blending them into the final image shouldn't be too hard.

Before I start to implement stencil shadows, I first need to understand the model renderer and probably replace it by a better one (as I said: I have written a pretty well optimized model renderer for D2X-XL using VBOs that understands POF, OOF and ASE formats). That would be both beneficial for FS and make it easier for me to add stencil shadows as I know my own code pretty well. ;)

I have read that FS2 open already uses shaders and I need to find out how and to what extent. I don't know e.g. whether it already uses per pixel lighting. If not I could add that, and in a subsequent step we could implement bump mapping to give the ships more detail at little extra cost (would require somebody to create bump maps for the ship textures though).

Another thing I'd really like to see are smoke trails for missiles. These are easy to implement and really give an entirely new dimension to a game like FS because they add a real sense of depth and distance to huge scenes like those in FS.

I am currently having a problem with checking out the source code from the SVN repo (svn://svn.icculus.org/fs2open/trunk/fs2_open). Either I get a gateway error (#502) or a message that icculus.org doesn't respond. :(
« Last Edit: May 07, 2009, 05:18:10 am by karx11erx »

 

Offline pecenipicek

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


bump maps are kind of irrelevant and completely redundant when we have normal maps....




as for the errors in the svn, check your router is my first hunch...
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 karx11erx

  • 27
  • D2X-XL and DLE-XP coder
    • Descent 2 & D2X-XL
Re: Implementing shadows(self-shadowing first) in GLSL...
Well, I can access the D2X-XL SVN repo on SF.net, but icculus.org doesn't respond ... can be the network I am in, or icculus.org - can't tell from here. I will retry later.

Are your normal map vectors in object or tangent space?

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Implementing shadows(self-shadowing first) in GLSL...
I am currently having a problem with checking out the source code from the SVN repo (svn://svn.icculus.org/fs2open/trunk/fs2_open). Either I get a gateway error (#502) or a message that icculus.org doesn't respond. :(

That is strange. It's working just fine for me, just tested it now. Does the web access work for you?
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline karx11erx

  • 27
  • D2X-XL and DLE-XP coder
    • Descent 2 & D2X-XL
Re: Implementing shadows(self-shadowing first) in GLSL...
Forget it. Maybe it's the network firewall here.

Still need to know whether the FS normal maps are in tangent space ... and need to fully understand tangent space calculations ... http://www.3dkingdoms.com/weekly/weekly.php?a=37 ?

 

Offline pecenipicek

  • Roast Chicken
  • 211
  • Powered by copious amounts of coffee and nicotine
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • PeceniPicek's own deviantart page
Re: Implementing shadows(self-shadowing first) in GLSL...
tangent space.
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.

 
Re: Implementing shadows(self-shadowing first) in GLSL...
Stencil shadows are cheap performance wise, particularly in an environment as FS with no static geometry (only objects). Soft shadows are costly. Depends on what class of machines you want to be able to have shadows on ... ;7
There is also stencil shadow method which produces very realistic soft shadows with realistic umbra/penumbra and it has a free source code.. ;)
http://graphics.cs.lth.se/research/shadows/

 

Offline Flipside

  • əp!sd!l£
  • 212
Re: Implementing shadows(self-shadowing first) in GLSL...
[Bookmarks those links for the day he can understand the math]

 

Offline emi_100

  • 28
  • www.artstation.com/emimartinez
    • Skype
    • artstation.com/emimartinez
Re: Implementing shadows(self-shadowing first) in GLSL...
i can't help you anyway i don't know anything about coding, but I love the idea of having real shadows in game!
This feature will be amazing  :)
Good luck!
DEDICATED TO ALL THE
PEOPLE WHO PREDICTED
THAT THE BABYLON
PROJECT WOULD FAIL IN
IT'S MISSION.

-------FAITH MANAGES------
  • Normal Maps for -The Babylon Project-
  • "Battle at ..." (Campaign) You can't choose when, but you will choose where... and you will fight! GO NOW!
  • "One Mistake" (Third Space Campaign)
  • "Each Night I Dream of Home" (Crusade Single Mision)

 

Offline Aardwolf

  • 211
  • Posts: 16,384
    • Minecraft
Re: Implementing shadows(self-shadowing first) in GLSL...
* Aardwolf sides with Herra on the 'realism' debate, and karajorma on the 'feasibility' aspect.

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: Implementing shadows(self-shadowing first) in GLSL...
back to nebs i think self shadowing in the nebula would be awesome whenever a lightning bolt goes off. even if the shadow is well lit because of ambient light, it would still look pretty cool to have the exposed side brightended and to show some lines.

as for smoke i think implementing it in a space engine would be more difficult than in d2xxl, because of the longer distances the trail must travel. for it to look good you would need to render a great deal many more sprites. this is evident in my particle build. while my high level code allows you to construct some interesting effects, the pre-existing low level code is just too slow to handle it.
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 Aardwolf

  • 211
  • Posts: 16,384
    • Minecraft
Re: Implementing shadows(self-shadowing first) in GLSL...
I wonder, what if you grouped the emitted smoke particles by when they were created, by when they were emitted? In theory, they should all be close together, so you could cull entire groups of particles before determining which particles in the group need to be drawn.

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: Implementing shadows(self-shadowing first) in GLSL...
thats kinda how my helical trail works. the code figures out how much of the trail to create, then creates those particles. actually i think that slows things up abit. theres also a bug where if you dont release particles every frame that youl get gaps. if i fix that bug then that type of trail will work better. for smoke you would use more of a simple trail with a few particles created every frame. with a short enough lifespan particles will be removed. trick is to strike an equilibrium between particle creation and removal. its currently very easy for a moder to create way too many particles and overload the system.

theres also issues with fadeout. particles just dont, unless you animate them. but that creates other concerns. id like paticles to either fade out over the particles whole life span or part of it to smooth out the deletion of the trail. perhaps even make it possible to get rid of the bitmaps as well (rgba particles) if it improves perfromance. treat particles as primitives rather than sprites.
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 Luis Dias

  • 211
Re: Implementing shadows(self-shadowing first) in GLSL...
 :bump:

(I'd love to see shadows in FS!!)