Deferred Shading with Alpha support!!!

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
dlangdev
Posts: 1324
Joined: Tue Aug 07, 2007 7:28 pm
Location: Beaverton OR
Contact:

Post by dlangdev »

Please do it, as I'd like to know how they fit together. I mean how MRTs and G-Buffers work with shadowMaps, bumpMaps, Etc.

What was demoed here was diffuse and specular. Not sure if emissive was in there, maybe not. I'm sure calculation of normals were not shown as well.

I'm assuming bump maps will have to be shader-driven, though. Coz, I still have no idea how fixed-function and shaders work together to produce all these effects.

Anyway, I've got hold of a sample opengl code showing deferred shading. The code will teach me how it works, I guess.

http://www.paulsprojects.net/opengl/def ... fshad.html

Image


I had to update my dev machine to use glext.h and wglext.h

see: http://www.opengldistilled.com/downloads.html
Image
Virion
Competition winner
Posts: 2148
Joined: Mon Dec 18, 2006 5:04 am

Post by Virion »

nice 8)
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Post by Nadro »

dlangdev wrote:Please do it, as I'd like to know how they fit together. I mean how MRTs and G-Buffers work with shadowMaps, bumpMaps, Etc.

What was demoed here was diffuse and specular. Not sure if emissive was in there, maybe not. I'm sure calculation of normals were not shown as well.

I'm assuming bump maps will have to be shader-driven, though. Coz, I still have no idea how fixed-function and shaders work together to produce all these effects.

Anyway, I've got hold of a sample opengl code showing deferred shading. The code will teach me how it works, I guess.

http://www.paulsprojects.net/opengl/def ... fshad.html

Image


I had to update my dev machine to use glext.h and wglext.h

see: http://www.opengldistilled.com/downloads.html
Hi, In deferred shading You don't use fixed function of shader. You use standard shaders, but parameters eg. Position, Normal, VF for DiffuseMap etc. You don't read from current rendering vertices, but from textures writes in G-Buffer, thats is all idea about Deferred Shading. Of course You can add some optimization for You deferred shading, eg pack all values to RGBA8 or pack all into one RGBA32F (You don't need MRTS at these moment), but this isn't standard operations;)
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Post by christianclavet »

Hi Nadro.

Following the dlangdev infos on the video card:

Here the spec from the IRRlicht screens:
Irrlicht Engine version 1.4.1
Microsoft Windows Vista Personal Service Pack 1 (Build 6001)
Using renderer: Direct3D 9.0
NVIDIA GeForce 9800 GX2 nvd3dum.dll 7.15.11.7516
Loaded mesh: media/room.3ds
Loaded texture: media/wall.jpg
Loaded texture: media/Dwarf/axe.jpg
Loaded texture: media/Dwarf/dwarf.jpg
} found in dataObject
Loaded mesh: media/Dwarf/dwarf_hipoly.x
Here is the screen from the low poly deferred method (steps: A,A,B,A)
Image

Here is the screen from the high poly deferred method (steps: A,A,B,B)
Image

Only 27 FPS difference between the low and high poly, not too bad! (Considering that I got over 300 on each tests! :D )
Is there a way to test with 100,000 poly as you talked about? The current limit of your demo is 40K poly
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Post by Nadro »

Thanks for test it:) I release today version with 100 000 poly on scene in VBO for DirectX and OpenGL. How is difference in FPS on Your High-End card between Hi poly in forward rendering and deferred shading? In normal games some objects are animated, so we can't use full VBOs for all objects. I think than in current games 100 000 poly per frame is standard, but in my demos I set all models are static, so We will full VBOs support for it, so difference between forward rendering and deferred shading will be smaller than in normal game, but difference is visible also on my Radeon 2600 PRO, of course deferred shading is faster:)
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
dlangdev
Posts: 1324
Joined: Tue Aug 07, 2007 7:28 pm
Location: Beaverton OR
Contact:

Post by dlangdev »

Hi Nadro,

Thanks for the help, really appreciate all you're doing, helping me and others go forward with Irrlicht.

So far, I have bits and pieces of information, and no complete knowledge on how they fit seamlessly.

Fortunately, I stumbled into Paul's Octogon Engine, he made a demo engine for others to study. Looks like I'll be sitting down and will be be studying that code for awhile.

And it looks like the code has some examples of bumpmapping, shadowmapping, emmisions in there as well. I'm hoping to figure how the code runs it and hopefully implement them on Irrlicht.

So, yeah, thanks for all the help, keep up the good work.

Image
http://www.paulsprojects.net/opengl/oct ... tagon.html
Image
PI
Posts: 176
Joined: Tue Oct 09, 2007 7:15 pm
Location: Hungary

Re:

Post by PI »

Thanks for the demo!

My results:

AAAB: 128-140 FPS
AABB: 50-70 FPS
BAAB: 90-100 FPS
BABB: 90-100 FPS

Ati Radeon HD 2600 Pro.

The OpenGL results are the same.

Cheers,
PI
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Post by Nadro »

I release version 1.01 (I replace link for download it in first post). In new demo I up camera visible range (now scene not bluring when we go back with our camera) and I add 3 nodes for scene, so low poly scene now Is around 8000 poly and hi poly scene 100 000 poly in VBO;)
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
dlangdev
Posts: 1324
Joined: Tue Aug 07, 2007 7:28 pm
Location: Beaverton OR
Contact:

Post by dlangdev »

low-cpu, high-gpu test machine.
cpu: celeron
gpu: 3850

option: A,A,B,A

Image

option:A,A,B,B

Image
Image
Halifax
Posts: 1424
Joined: Sun Apr 29, 2007 10:40 pm
Location: $9D95

Post by Halifax »

By the way, I have a question, about what I encountered in something about deferred shading.

One is, do you know how you are going to overcome the transparency problems? And will there be a possible demo that shows this?

Also, what about the one material thing that I have heard about. I don't know how to explain it exactly, but it can be seen in new games coming out like The Hulk video game. His skin is obviously to shiny, just like his jeans, and they appear to have the same material.

I think it has something to do with a one material problem or something, because of the limited amount of MRT buffers. By the way here is a picture of what I'm talking about:
http://media.movieweb.com/news/03.2008/hulkgame/01.jpg
TheQuestion = 2B || !2B
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

Wow the Hulk looks like hes from PS3 and the background looks like its from PSONE :O

For the transparency thing, you can just draw em' forward rendering style. Another way is through "deep deferred shading", heres an example of that: http://www.humus.ca/index.php?page=3D&ID=75

You can have quite a few different material types with deferred shading, just render different indexes to a "material id" buffer, and switch between different lighting models etc inside the lighting pixel shader. Also, alot of people would encode the specular strength of the materials (Kinda like a specular map), in the alpha channel of the depth or normal textures.

Cheers
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Halifax
Posts: 1424
Joined: Sun Apr 29, 2007 10:40 pm
Location: $9D95

Post by Halifax »

Ah, alright BlindSide. And yeah, it is surprising to see the difference between the Hulk and the background.
TheQuestion = 2B || !2B
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Post by Nadro »

Hi Halifax,
Yes, in deferred shading is problem with transparent objects but I will try implementation it in Friday, when I go back to home:)

BTW. christianclavet and dlangdev can You compare performance of deferred shading with forward rendering test? What rendering technique is better on Yours card? In low poly probably forward rendering, but in hi poly?:)
Last edited by Nadro on Wed Jun 25, 2008 10:03 pm, edited 3 times in total.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
dlangdev
Posts: 1324
Joined: Tue Aug 07, 2007 7:28 pm
Location: Beaverton OR
Contact:

Post by dlangdev »

sooooo beautiful, soooo very technical, soooo much math.

my brain got fried yesterday studying soft shadows in deferred shading. and i still don't get it. i'll try again tonight.

with this render, the technique behind it will surely blow my brains out.

Image
Image
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Post by christianclavet »

Hi. Tested again with the new version:

My current system: (French Vista 64)
Image
For IRRlicht a QUAD CORE serve nothing, only the MHZ and CPU type count. So about ANY cpu running at 2,66Ghz should be an equivalent in processing.

Video card report: (NVidia 9800GX2)
Irrlicht Engine version 1.4.1
Microsoft Windows Vista Personal Service Pack 1 (Build 6001)
Using renderer: Direct3D 9.0
NVIDIA GeForce 9800 GX2 nvd3dum.dll 7.15.11.7516
Only High poly have been tested:
TEST1 - DIRECTX9.0 - FORWARD RENDERING:
Image
TEST2 - DIRECTX9.0 - DEFERRED SHADING:
Image

TEST3 - OPENGL - FORWARD RENDERING:
Image
TEST4 - OPENGL - DEFERRED SHADING:
Image

Strangely the output give me 603396 on the forward rendering not 100578 like the deferred ones.
Post Reply