Oren-Nayar-Blinn material model Blender version.

General discussion about the development of the open source Blender

Moderators: jesterKing, stiv

cessen
Posts: 109
Joined: Tue Oct 15, 2002 11:43 pm

Oren-Nayar-Blinn material model Blender version.

Post by cessen »

I have implimented an oren-nayar-blinn material model in tuhopuu, but I am not going to commit it because I have bigger plans for the material system. But I do want people to be able to mess around with it, so here it is:
http://www.brunslo.com/cessen/blender_s ... mic.tar.gz

Unluckily, I only have a Linux version compiled (my apologies to the rest of you who want to try it out).

A few notes:
1) the roughness setting applies to both the specular and diffuse roughness. Since this is not really meant to be a widely used modification, I didn't bother to add a seperate button.
2) at the moment hemilights do not light the material in a way that looks right (I'm working on it).
3) the IOR setting is analagous to the spec setting that was previously there, it's just that this has a true physical interpretation (it *is* the actual IOR, so incase you want to simulate real materials...). However, since there is no raytracing in blender, the IOR setting has nothing to do with refractions.

Comments and questions are welcome!

Jamesk
Posts: 239
Joined: Mon Oct 14, 2002 8:15 am
Location: Sweden

Post by Jamesk »

That's great news! I've always thought that the simple phong-only model was a bit of a shortcoming in the current renderer.

It'll probably be just 6 months or so until I can get my hands on a win binary with your stuff in it, then? :wink: :wink: :D

matt_e
Posts: 410
Joined: Mon Oct 14, 2002 4:32 am
Location: Sydney, Australia
Contact:

Post by matt_e »

Wow, that sounds great, Cessen! I remember you mentioned on elysiun.com that if Blender became open source, you'd add this shading method. It's great to see you're true to your word :)

Would you be able to post some renders of it in action, for us poor windows/mac/etc. users that can't download the build itself?

Manuel
Posts: 56
Joined: Wed Oct 16, 2002 12:48 am
Location: Italy
Contact:

Re: Oren-Nayar-Blinn material model Blender version.

Post by Manuel »

cessen wrote:but I am not going to commit it because I have bigger plans for the material system.
Thanks!
I've a question: the new material system in your plans will be compatible with old material library?

And a request: it's possible modify the "emit" parameter in a
"real" phisical variable (I.E watt, or watt/s, etc...) to use the
radiosity in technic simulation?


Excuse for my poor english,

Manuel

hannibar
Posts: 50
Joined: Wed Oct 16, 2002 3:02 pm

Post by hannibar »

Glad to hear that you are working on it.

A small question though. What is the difference between phong and oren-nayar-blinn (the big lines)?

cessen
Posts: 109
Joined: Tue Oct 15, 2002 11:43 pm

Post by cessen »

That's great news! I've always thought that the simple phong-only model was a bit of a shortcoming in the current renderer.
Oh, perhaps I should have mentioned this in my original post: the Oren-Nayar-Blinn model I've implimented *replaces* the Lambert-Phong model. (This is one of the reasons I am not going to commit it, because it wouldn't render scenes of previous blend files correctly.)

I suppose one thing I could do (for practice of implimenting new GUI elements in Blender) would be to make the material type switchable between Lambert-Phong and Oren-Nayar-Blinn. Then I could commit it, and simply replace it with my "bigger plans" when they are finished.
It'll probably be just 6 months or so until I can get my hands on a win binary with your stuff in it, then?
If someone would be willing to compile it for me, you could have it as soon as you want (I'd be happy to upload the source tarball). The problem is that I don't have a Windows compiler...
Wow, that sounds great, Cessen! I remember you mentioned on elysiun.com that if Blender became open source, you'd add this shading method. It's great to see you're true to your word
I try. :) Of course, I did take my sweet time about it...
Would you be able to post some renders of it in action, for us poor windows/mac/etc. users that can't download the build itself?
Certainly:
http://www.brunslo.com/cessen/blender_stuff/blinn1.jpg
http://www.brunslo.com/cessen/blender_stuff/blinn2.jpg
http://www.brunslo.com/cessen/blender_stuff/blinn3.jpg
http://www.brunslo.com/cessen/blender_stuff/blinn4.jpg
http://www.brunslo.com/cessen/blender_stuff/blinn5.jpg
http://www.brunslo.com/cessen/blender_stuff/blinn6.jpg
I've a question: the new material system in your plans will be compatible with old material library?
That's the plan. I intend to make the BRDF programmable (via a plugin system). Basicly, it will be a material-plugin system. And, of course, it will have a default of the standard Blender Phong model.

But don't hold your breath, it's probably going to be quite some time before I have it done... heck, I'm still just getting familar with the code (the oren-nayar-blinn mod was an excercise to help me on that account). Also, there is the cross-platform issue. Someone would have to help me make the system work for OS's other than Linux.
And a request: it's possible modify the "emit" parameter in a
"real" phisical variable (I.E watt, or watt/s, etc...) to use the
radiosity in technic simulation?
I'm sure that could be done. However, there are some more complex issues as work. For instance, just because the values represent watts doesn't mean that your monitor will display them at all accurately, and thus the physical analogy wouldn't really be useful.
A small question though. What is the difference between phong and oren-nayar-blinn (the big lines)?
In reality, there are two comparisons. The comparison between Lambert and Oren-Nayar, and the comparison between Phong and Blinn.

Lambert is the material type you get in blender when "spec" is set to zero. Phong is what you get when "ref" is set to zero. The two are simply added together.

Now, Oren-Nayar is a more advanced version of Lambert:
It allows you to make things look much rougher than is possible with Lambert (see blinn3.jpg), via a user modifiable roughness setting. When the roughness is set to zero, it is exactly the same as Lambert (so there's really no reason not to replace Lambert with Oren-Nayar, since Oren-Nayar is capable of being identical to it).

Blinn is a physically based specular reflection model. Phong, on the other hand, has so real physical basis... it just happens to look ok to the human eye under many circumstances. Blinn takes into account many things that Phong does not.

For instance, at the microscopic level the roughness of a surface is really a bunch of bumps and valley's: those bumps and valley's can cast tiny microscopic shadows, which, all of them put together, can significantly alter the brightness of a given point on a surface. The Blinn model takes this into account via a statistical method (it doesn't individually calculate all the little microscopic shadows, of course: that would take forever).
(In case you're curious, the Oren-Nayar model takes those tiny shadows into account as well.)

It also takes into account what is called the "fresnel effect", which basicly is the phenomina (spelling?) of materials being more reflective at sharper viewing angles (think of it like a rock skipping: the light has a better chance of bouncing off--rather than being absorbed--if it hits the surface at a sharp angle).

One last thing that is nice is that the Oren-Nayar model and the Blinn model are compatable with eachother in the sense that they make the same assumptions about a surface. So, if they are both given the same roughness setting, they mesh together perfectly and represent an approximately physically accurate material.
(Neither model is perfectly physically accurate, but both are very close approximations. Lambert is physically accurate as well, as long as you assume a perfectly smooth surface.)

So, to summarize:

Oren-Nayar vs Lambert:
  • 1) Can make rougher looking materials.
    2) Fits with Blinn model.
Blinn vs Phong:
  • 1) Physically based; a very good physical approximation given it's assumptions about surfaces (such as being isotropic).
    2) Can make much glossier-looking surfaces, and much rougher looking ones.
    3) Fits with Oren-Nayar model.

I hope I didn't confuse people too much with the above explinations. :)

hannibar
Posts: 50
Joined: Wed Oct 16, 2002 3:02 pm

Post by hannibar »

Thanks for the good explanation. I didn't know ther could be so much difference between those two. They look totally different.

Anyway I'm very curious to play with it. Hope it will be in the official tree soon.

Pablosbrain
Posts: 254
Joined: Wed Jan 28, 2004 7:39 pm

Post by Pablosbrain »

Very cool news! Very cool indeed! Keep up the extraordinary work!

Jamesk
Posts: 239
Joined: Mon Oct 14, 2002 8:15 am
Location: Sweden

Post by Jamesk »

Now if you could keep both models, and let the user select (per material) which one to use - that would be saaawweeeet!

Let's hope some compiler jock can help out making a windows binary =)

Jamesk
Posts: 239
Joined: Mon Oct 14, 2002 8:15 am
Location: Sweden

Post by Jamesk »

And, oh.... by the way... I guess you're just dying to start implementing something anisotropic soon then?! 8)

Manuel
Posts: 56
Joined: Wed Oct 16, 2002 12:48 am
Location: Italy
Contact:

Post by Manuel »

cessen wrote:
And a request: it's possible modify the "emit" parameter in a
"real" phisical variable (I.E watt, or watt/s, etc...) to use the
radiosity in technic simulation?
I'm sure that could be done. However, there are some more complex issues as work. For instance, just because the values represent watts doesn't mean that your monitor will display them at all accurately, and thus the physical analogy wouldn't really be useful.
Thx for explanation. I think the energy in watt can be a good starting point
to simulate a realistic situation. In particular, a more technic approach
can be offer a new possibilities of professional work, I.E. lighting system
simulation. I think (excuse for my poor english) that is not really hard
for you modify a little the interface to enable some features like lightscape. :)

However, I don't want load you with my request...

Cessen you make already a great work!
Thanks!
Thanks!
Thanks!

cessen
Posts: 109
Joined: Tue Oct 15, 2002 11:43 pm

Post by cessen »

Now if you could keep both models, and let the user select (per material) which one to use - that would be saaawweeeet!
Ok. I'll do that. Besides, then it can be incorperated into the official tree sooner. It might take a while, though. I'm still not very familiar with the GUI code: but this will be a great excircise to help me get used to it.
And, oh.... by the way... I guess you're just dying to start implementing something anisotropic soon then?!
As I said earlier, my plans are to impliment a plugin system. I am not going to hard-code any more material models into Blender. But the plugin system (once finished) will allow anyone to impliment an anisotropic material model.
Thx for explanation. I think the energy in watt can be a good starting point to simulate a realistic situation.
Something that could be done relatively easily would be to allow the emit value to have a range much larger that 0.0-1.0. Then you could interperete the values as watts. After all, you can interperete the values however you want to. Calling them "watts" is just an issue of adding a label :)

Jamesk
Posts: 239
Joined: Mon Oct 14, 2002 8:15 am
Location: Sweden

Post by Jamesk »

You da man! Seriously, I mean it.

Manuel
Posts: 56
Joined: Wed Oct 16, 2002 12:48 am
Location: Italy
Contact:

Post by Manuel »

cessen wrote: Something that could be done relatively easily would be to allow the emit value to have a range much larger that 0.0-1.0. Then you could interperete the values as watts. After all, you can interperete the values however you want to. Calling them "watts" is just an issue of adding a label :)
To use this method, I must know this:
max emit value = watt ?
Mhh...I want sell my work. A client can ask me to simulate a
illumination using a exact model of lamp. I read all lamp documentation,
and use some paramenter in Blender. This is my idea:

http://www.elysiun.com/forum/viewtopic.php?t=9680


I know python (http://www.kino3d.com/~MakeHuman/),
but not C :cry:

Anyone can help me?

Dani
Posts: 143
Joined: Fri Oct 18, 2002 8:35 pm

Post by Dani »

Hi Cessen! This is a major step forward in the way of imroving blender's renderer.

You could make your plugin interface and make your oren-nayar-blinn BRDF be the first plugin, so we can use it as a model to understand how to code these plugs... no?

Dani

Post Reply