Jump to content

  • You cannot edit this iotd

Realistic Realtime Car Rendering  by Krypt0n    *****


Time Spent: 1 Month
Date Added: Aug 04 2011 05:26 PM

I've invested my spare time of the last month to finally get into BRDF rendering based on measured Databases, I've used (http://www.merl.com/brdf/ )

At first I started with the usual raytracing of some primitives, but although realistic, it was a bit boring.

Then I decided to try to do it realtime, it was working surprisingly well, but still boring, so I've been looking for a nice car Model, so I found this Bugatti Veyron, modelled by Valery Gus'ev (http://www.arlont.kiev.ua/ I know it's down, but that's what I saved for copyright notes and it's also the only url included in this model archive). This car consists of 48 parts, each assigned with a nice BRDF from the database.

During developing the amount of data rised quite a lot, I ended up with about 500MB to render this car (e.g. the HDR skybox, which I got from http://www.smartibl.com/sibl/archive.html, are sometimes 8k x 4k ) and each BRDF has 32MB. So I've also added runtime updating of materials (tiny script files), shaders, textures, BRDFs, meshes, I can't tell you how amazing it is to just save a shader and immediatelly see the result.

I've uploaded quite a bunch of images, they show

47 - shows off the metallic shader

52 - depth of field rendering and blooming on the back light, you see a nice black paint on the back and a white pearl paint on the front part of the car

60 - shows a color changing paint in combination with subtle metallic flakes in the paint

65 - I was trying to get it kind of looking like this: http://www.carvehicle.net/wallpaper/1/2009/04/bugatti-veyron-2009-6.jpg

73 - show offs nicely the HDR lighting, although the sky is tonemapped to white, as it is the brightest source, you see blue'ish fresnel reflection on the paint, which is the most intensive color component of the sky, usually

79 - although the back light is not a BRDF anymore, it's kind of a hand made HDR texture, I breaks my desire for perfection, but looks better :/

80 - there is a special Veyron version called "pur sang", it shows how the car is made of carbon fiber and metal. That's why I've implemented a carbon shader, like you hopefully see on this screenshot

- it also visualizes my special anti aliasing solution, I render with 2X MSAA, my custom resolve calculates a tangent of edges (similar to FXAA, SSAA etc.) but based on the HDR buffer, which is more correct, as you work in linear space. This bluring is just applied where the MSAA sample-pair of a pixel is not equal (so MSAA "detects" the borders") and finally I use the tangent to blur along the tonemapped LDR buffer, before it is transformet to the correct gamma space. this gives me better quality then 4XMSAA on stil images and has far less aliasing on moving images then those usual postAA.

81 - correct refraction on the front lights, this gives you the rainbow alike color

there rest is to please your eyes :)

it's running smoothly on a macbook without the antialiasing (I didn't check with it). it's obviously not a challenge for a newer DX11 card, I think that quality rendering could also run on consoles.

visual studio 2010, c++

  • You cannot edit this iotd


Aug 09 2011 08:20 PM
That's a hell of a good looking render. One thing though... where's the video and demo? ;)
Aug 09 2011 10:35 PM
The close-up of the headlight looks amazing
Aug 10 2011 03:50 AM
Looking really good.

PS: I downloaded some HDR packs from sIBL archive but apparently they only contain images... Where do you get the skyboxes?
Aug 10 2011 04:51 AM
now wheres the recommend/showoff this button...
they look really good!

can you upload some of a ferrari and lamborghini ?
i would love to have to have that for my wallpaper, maybe you could add one of those water marks to it with your name or something ?
Aug 10 2011 05:45 AM
Very nice.

How expensive are your BRDF shaders (e.g. in instruction counts, or cycles, etc)?

p.s. yeah, runtime updating of content is a brilliant features that everyone should implement!
Aug 10 2011 07:01 AM

At first I started with the usual raytracing of some primitives, but although realistic, it was a bit boring.

Then I decided to try to do it realtime, ...

So, its realtime raytracing?
Aug 10 2011 10:44 AM
Beautiful renders. Very nice work. :cool:

Kudos for mentioning the source of your model and honoring copyright. Mad props from an artist.
Aug 10 2011 04:47 PM
So is this raytraced? I suppose so, but your description doesn't make it so clear. If so, what's "realtime"? Card, accelerated raytracing structure, performance?

Well, whatever the answers are it sure looks nice! Forza 5 here we come.
Aug 11 2011 03:10 AM
thanks for all the positive replies, working on something by yourself all time makes me quite biased and I loose any objectivity to judge if it's good or crap ;)

@px I'm just waiting for a publisher who wants me to make a demo for him *jk*, I'd honestly like to have a demo where you could drive around (I've also set up the whole interior, the driver's view would be nice!), but it would be quite some content work to get a track etc. :/

@TiagoCosta my link was already directly to the archive, e.g. some screenshots I made are using the "Desert Highway" from their page. A Skybox is just an image ;)

@ryan20fun Thanks :), sadly I don't have a ferrari neither a good lamborgini model :( I was happy to find this decent Veyron model.

@Hodgman I didn't count the instructions, it was running smooth on my NVidia 320m gpu, which stole all my motivation to optimize it ;), but the BRDF look-up is quite expensive, several atan,sin,cos to transform from cartesian worldspace to angular half-space (by half I mean the half vector commonly used for lighting), and then indexing into the volumetexture.... and sometimes, like for the metallic flakes or the carbon fiber shader I have to do it several times (otherwise it just looks like shader aliasing). There is for sure room to optimize e.g. the metallic flake noise could be applied after everything is in the half-space

@kudi @Locater16 sorry for my ambiguous choice of words, no it's not raytraced (although I have the same running as raytracing, as I used it to have reference images). It's simple forward rendering using vertex+fragment programs. There is a little math involved to intersect the view rays and the reflection rays with the skybox (as I don't have any geometry for it), but that's barely called raytracing IMO.

@third_ronin I'm sure that artist, researcher and that company put a lot of effort into their work and without them my research would be impossible, the least I can do is to credit them.

cheers guys :)

btw. sometimes I post WIP screens on twitter/twitpic, in case someone wants to see it, you could follow me (or save the link) ;) http://twitter.com/michael_hpp http://twitpic.com/photos/michael_hpp

Aug 15 2011 07:32 PM
I'd be interested in how you get the BRDF tables onto the GPU -- a 32MB 3D array of doubles seems quite excessive!
Do you compress the data at all, or rearrange it's layout?
Aug 25 2011 12:05 AM
Aah Its like dirt 3.............
Its aweeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeessssssssssssssooooooooooooooommmmmmmmmeeee.
Sep 10 2011 03:21 AM
Quality work!
/ Blochi
Oct 07 2011 02:58 AM
Hey Krypt0n,

Those are really sexy renders, unbelievable quality for realtime. I'd really love to see a video, preferably on Vimeo... One of the most creative uses for the my sIBL images I've seen so far.

I got a few questions:
1. Did you use a split lookup for view ray and reflection ray, directed to the background and reflection images?
2. What shading language did you do that shader in? CGFX? If so, I'd be really interested in that.
3. The ground stretching looks horrible in some, but I know how it is... What would you say if a package had matching geometry? And would OBJ format work out for you?

FYI - HDRLabs is not a company at all, it's an artist and photographer / developer community.

Christian Bloch
Oct 13 2011 02:31 AM
Sorry, I wasn't monitoring this thread.


I've developed several ways to store the data, the most excessive version is using the orginal resolution with 4floats for each entry.

the least memory consuming version is 32x32x32 with an RGBE format, still giving acceptable quality.

beside this generic quantizations, I did not use any "smarter" ways to reduce the data, as most of those try to approximate the BRDF in which case they filter out all high frequency "noise", and the "noise" is what gives measured data the spice.

@Rup Kumar && Tachikoma

thank you guys :)


i've send you a detailed reply using the contact form on your page