Virtual Cubemapping demo

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
Halifax
Posts: 1424
Joined: Sun Apr 29, 2007 10:40 pm
Location: $9D95

Post by Halifax »

Dorth wrote:That is nice. But I think he pretty much asked for a textual description, not a visual demo.
Well every little bit helps, and it doesn't hurt to give some other type than what is asked. And it also isn't like it hasn't been asked, and explained, on gamedev.net.
TheQuestion = 2B || !2B
Dorth
Posts: 931
Joined: Sat May 26, 2007 11:03 pm

Post by Dorth »

Halifax, I usually like your help. But saying it's been explained elsewhere is like saying google it, rtfm, or anything like that. It is not a useful comment and unless someone clearly shows he hasn't tried anything to find the info or is rude about it, you should give the minimal help. My take on it anyway ;)
Halifax
Posts: 1424
Joined: Sun Apr 29, 2007 10:40 pm
Location: $9D95

Post by Halifax »

Dorth wrote:Halifax, I usually like your help. But saying it's been explained elsewhere is like saying google it, rtfm, or anything like that. It is not a useful comment and unless someone clearly shows he hasn't tried anything to find the info or is rude about it, you should give the minimal help. My take on it anyway ;)
I understand your take on it, and I am just providing my abilites. I am not going to sit here and BS like I know the exact details (so I provided a minimal place to find an explanation), but I have seen what it can do, and if I understand correctly it basically miminzes the calcluations for 360 degree lighting.

It reduces the calcluations by taking away the need to use raycasting in your code by just projecting a cubemap on the scene, and making the shadow with that. It significantly reduces the calculations needed.

(That it is what I know to the best of my ability, feel free to correct me. (BlindSide))

And by the way, sorry Dorth, I will take your criticism in to min d next time. Thanks.
TheQuestion = 2B || !2B
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

Technical description:

Cubemap: A cubemap is a texture array packed with 6 textures, each one simulating the face of a cube.

Virtual Cubemap: Simulates a cubemap by sticking 6 textures into one big texture then offsetting the texcoords to simulate reading from the different sides.

Projected cubemap: Each side of the face is projected in a 90 degree FOV in each direction of the cube.

Nothing more, nothing less ;)

Ok ok, heres some screenshots of the "360 shadowmaps". You can see they are quite different from the original:
Image

Image
The spheres are lights.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
greenya
Posts: 1012
Joined: Sun Jan 21, 2007 1:46 pm
Location: Ukraine
Contact:

Post by greenya »

wow!
that is more practically :)
is it available an url to download the demo?
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Post by Nadro »

BlindSide wrote:
Nadro wrote:I can't run this demo... I have problems with Your DirectX apps BlindSide (with this demo and the latest XEffects in DX mode) OpenGL apps work without problems :) This is maybe cause by my drivers for HD2600 for AGP:P But demo on screenshot looks very good:) Good work BlindSide!
This is an OpenGL app. What kind of problem happens? Does it crash? I would really appreciate any info regarding this. Thanks.
Yes, demo is crash on startup, only Win98/WinNT mode demo work properly. looks very good:)
BlindSide wrote:Please note: On ATI cards this demo runs a 512x512 texture because ATI cards seem to have poor framebuffer support (Or atleast my 200M does :P ). Nvidia cards run at a full 1024x1536 (Giving 512x512 for each face of the cubemap.).
This is Irrlicht OpenGL RTT problem. Radeon series lower than 2xxx hasn't got depth and stencil texture support (this textures are use in Irrlicht OpenGL RTT process). I put patch for improve it in this topic:
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=25469
I replace depth and stencil textures by renderbuffer. With OpenGL renderbuffer all works properly:)

Thanks BlindSide. New demo look very interesting:) I'm waiting for download link :)
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
Virion
Competition winner
Posts: 2148
Joined: Mon Dec 18, 2006 5:04 am

Post by Virion »

wow... i want to try the demo. :D
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

Nice work Blind Side :)
Just one question to second screenshot with multiple lights: There is something wrong with light in the scene as well as color of shadows ...shadows are colored while they should have no color since shadows are places where no light from lightsource reach. So yellow light should not project yellow shadow but the dark one.
And on the opposite side, there are three lights: yellow, blue and white ...but scene is lit as if they combine in to white color which they should not. Yellow+blue+white=light green.

Just curious...
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

Nadro wrote: This is Irrlicht OpenGL RTT problem. Radeon series lower than 2xxx hasn't got depth and stencil texture support (this textures are use in Irrlicht OpenGL RTT process). I put patch for improve it in this topic:
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=25469
I replace depth and stencil textures by renderbuffer. With OpenGL renderbuffer all works properly:)

Thanks BlindSide. New demo look very interesting:) I'm waiting for download link :)
I've already applied your multi-largertt-fpptextures-mrt-etc patch a long time ago (Although I haven't used any of those features in this demo) and I think that this was already fixed in there, but I'll look into it and make sure the sources match up with the ATI FBO patch, Thanks.

The new demo might come soon, there is still alot of polish to do.
arras wrote: Nice work Blind Side Smile
Just one question to second screenshot with multiple lights: There is something wrong with light in the scene as well as color of shadows ...shadows are colored while they should have no color since shadows are places where no light from lightsource reach. So yellow light should not project yellow shadow but the dark one.
And on the opposite side, there are three lights: yellow, blue and white ...but scene is lit as if they combine in to white color which they should not. Yellow+blue+white=light green.

Just curious...
I'm sorry but you are completely confused :P. If you look closer at the shadows, you will notice that the yellow ball casts the BLUE shadow, and that the blue ball casts the YELLOW shadow.

That is because I am using an additive technique that sums up all lights, this closely represents how lights work in real life. The shadowed areas are still lit by lights in which they are not in shadow from.

About the colour, when there are enough lights, the intensity is strong so it is capped at white, as there is no other colour to represent such greater brightness (Maybe I can use a higher multiplication effect at the end to represent over-brightness). Also remember that yellow and blue != green, this only applies to ink-based colours.

Thanks for the comments, everyone.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
agi_shi
Posts: 122
Joined: Mon Feb 26, 2007 12:46 am

Post by agi_shi »

Excellent work! I've been working on soft shadow mapping myself (Ogre :twisted:), and have a few questions:
- you're using PCF, right? Any specifics to avoiding sampling the wrong "virtual face" with the PCF filter?
- does this require PS3.0? I'd assume so, since you're probably using some kind of dynamic branching for the "virtual face" selection. I take it you just take the highest component of the light-to-vertex vector to figure the "virtual face" (+/- X/Y/Z), and then offset the texture coordinate based on which face you're using? Mind sharing a bit of an explanation here? I'd try stuff out right now, but I'm away from my coding environment for a while, and am really itching :twisted:.
- not sure if you mentioned this, but what resolution is the shadow map you're rendering to? For some good resolution shadow textures, wouldn't you need 6x1024^2? Mind rendering the shadow texture to an onscreen quad so we can see what it looks like :roll:?
- about your shadow mapping... won't it be tied to your own shader? If you were to use a specialized shader (for example, you wrote some special "sparky" shader or whatever for some game object), you'd need to manually recreate all of the shadowing/filtering code, amiright?
Either way, like I said: looks great!
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

agi_shi wrote:Excellent work! I've been working on soft shadow mapping myself (Ogre :twisted:), and have a few questions:
- you're using PCF, right? Any specifics to avoiding sampling the wrong "virtual face" with the PCF filter?
Right now I'm post-blurring the shadows in screen space, so its not a problem. However I've used PCF with it before and I didnt notice any problems there either, probably because I clamp my coordinates so that the filtering doesnt reach other faces of the cube.
agi_shi wrote: - does this require PS3.0?
This should work fine on PS 2.0. I've tested the Virtual Cubemapping on my ATI 200M and it ran fine.
agi_shi wrote: - not sure if you mentioned this, but what resolution is the shadow map you're rendering to? For some good resolution shadow textures, wouldn't you need 6x1024^2? Mind rendering the shadow texture to an onscreen quad so we can see what it looks like :roll:?
This is all adjustable. Cubemaps dont seem to suffer as much from aliasing because all maps are captured in a single direction at exactly 90 degrees FOV, this makes things like the edges of the pillars perfectly straight and so line up nicely. Right now I am using the sizes mentioned on the first post, and I also tried 6x1024^2 but I didnt notice too much of a visual improvement.

I would show you what the shadowmap looks like but it wouldn't tell you much because I am using 32-bit depth packing that uses all the colour components resulting in alot of randomly coloured pixels.
agi_shi wrote: - about your shadow mapping... won't it be tied to your own shader? If you were to use a specialized shader (for example, you wrote some special "sparky" shader or whatever for some game object), you'd need to manually recreate all of the shadowing/filtering code, amiright?
Not at all! This does the shadows in 2 passes, renders all the lights additively to the shadow buffer, then combines it with the colours of a fullbright scene in a post-processing pass.

This means that the actual materials of the shadows and your own are completely seperate and you are free to use whatever materials you want and still cast/recieve shadows.

Cheers
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

If you look closer at the shadows, you will notice that the yellow ball casts the BLUE shadow, and that the blue ball casts the YELLOW shadow.
True :)
That is because I am using an additive technique that sums up all lights, this closely represents how lights work in real life.
Yes thats true ...when adding light colors together (mathematically speaking) yellow+green+white = white not green.
yellow and blue != green, this only applies to ink-based colours
also true ...yellow (255,255,0) + blue(0,0,255) = white(255,255,255)

Ok ...keep it up BlindSide, good luck :)

B.T.W.: what it was with those ATI cards arrays and GLSL? Do you have some more info about it (I do have ATI myself and I am unable to pass array in to shader)
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

The ATI FBO patch changes the FBO to use a renderbuffer instead of textures for depth and stencil. This seems to be better supported for some cards. However, the patch simply removed the old stuff, so I'm still trying to merge both things into the code.
jingquan
Posts: 222
Joined: Sun Aug 20, 2006 4:10 am
Contact:

Post by jingquan »

Those pics are so beautiful. Looks alot like shadowmapping, good job. Looks a little blur but I like it.

I'm wondering if Irrlicht will have cubemaps support soon(1-2 mths perhaps :D ), if not, I'm going to try to create something like this (I mean the cubemap) too when I find the time.

I've given up on shadows since my last PCF gives pockets of random artifacts.

Keep up the good work.
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Much props Blind Side, the latest screenshots look very impressive!

I can't run the demo from the first post on my PC though, just crashes on startup :(
Image Image Image
Post Reply