Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 

 Home / 3D Theory & Graphics / Raytracing question - Specular or Reflection? Account Manager
 
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
 
TaskForce_Reivax

May 24, 2005, 02:11 PM

In that screenshot, what he calls "diffuse reflection" is really "glossy reflection".

Thanks for helping me get the terms straight. I think concepts are more important than terms, so as long as I implement the concept correctly, what it's called doesn't matter much; except when I'm writing the feature set of the ray-tracer :D

It goes to show that you shouldn't try to take the terms used too literally.

Yes, I see your point.

 
Reedbeta

May 25, 2005, 01:27 AM

Willem wrote: If you have ever implemented ambient occlusion, you will know that the most straight-forward way to calculate the ambient occlusion factor in the first place is to just shoot a buttload of random rays into space. So if you'd need a lot of random rays to make diffuse reflection to look pretty, you'd need a proportional number of random rays to make your ambient occlusion look pretty.


Right, but the ambient occlusion map can be precalculated while simulating true diffuse reflection would require tracing those hundreds/thousands of random rays at render time. Since he is trying to do a real-time raytracer that would clearly not work.

 
davepermen

May 25, 2005, 05:25 AM

specular reflection simulates a glossy real reflection of the lightsource.

thats all it is.

 
Jacco Bikker

May 25, 2005, 09:32 AM

Asm isn't needed at all, not even for sse/sse2/sse3. The tracer that I used for my recent IOTD is pure C++ and uses intrinsics for sse/sse2.

Using asm can in fact harm performance: You make it harder for the compiler to shift bits of code around, and you probably force it to save / restore registers before and after your code.

 
Willem

May 25, 2005, 09:36 AM

So it's not useless at all, then. :) Not even theoretically.

 
davepermen

May 25, 2005, 09:40 AM

it is theoretically useless as it's just an approximation, wich are in theory all just useless :D

but in practice, cheap and nice. it gets useless (even wrong) if you have a good renderer, means one, that can handle gi. at the point you do gi yourself, and have glossy real reflections, there is no need for specular, and you _have_to_ remove it.

but for anything even just near to realtime by todays hw, specular is useful.

 
tokjunior

May 25, 2005, 11:48 AM

Oh, i had no idea there were instrinsics for it :)

 
Willem

May 25, 2005, 02:27 PM

"it is theoretically useless as it's just an approximation "

The rendering equation is an approximation too, does that make it theoretically useless?

 
davepermen

May 25, 2005, 04:09 PM

the rendering equation can theoretically be described in all known detail, and, as such, isn't at this moment an approximation. it is (till now? :D till ever, i'd guess) not possible to implement it in any way without approximating a.k.a. some discrete sampling routines.

approximations are the things you can not use in the final simulation. a final simulation can not solve the equation, possibly. but you can raise parameters to infinity and at one point, it would theoretically solve the equation.

specular lighting is not part of the equation. it can be used to approximate a similar solution, but it will not solve the equation.

thats where i draw the difference. there are "solutions" to a problem (or part of it). they are, or converge towards the solution of the original requested equation.
approximations are things that won't exactly ever solve the equation.

specular lighting is part of the phong equation. but the phong equation is only an approximation for a more complex material with glossy reflection on it.



and, in theory, approximations are useless. in practice, sometimes you don't need the full correct solution, but can get away with a part of it, or a part that is near to it.

rasterising is full of such approximations. bumped enviroment maps will never be 100% correct reflections, but they look close enough to be good enough in most cases. but they are, and will always be, an approximation.

 
TaskForce_Reivax

May 27, 2005, 07:04 AM

Jacco Bikker wrote: Asm isn't needed at all, not even for sse/sse2/sse3.

That definitely boosted my confidence, thanks Mr. Phantom!

 
Reinder

May 29, 2005, 09:36 AM

I believe specular reflection is a fast (but not correct) way of implementing the blurry (by not perfectly smooth surfaces) reflection of light sources. In my own raytracer I didn't implemenent specular lightning, but I got some nice results: http://www.reinder.net/screenshot.jpg & http://www.reinder.net/screenshot_2.jpg

 
TaskForce_Reivax

May 30, 2005, 01:00 AM

Impressive screen shots there.

Btw, I checked out your site and the ray-tracing section in it. Interesting stuff. But I intend the one I'm writing to be much more simpler with only basic effects because I want it to run in real-time. Thanks for putting up stuff for beginners like me.

 
Ono-Sendai

May 30, 2005, 03:49 AM

While its true that for a uniform conductor or dielectric the Fresnel term influences only the amount of light reflected as opposed to absorped/transmitted, for some real-world materials the Fresnel term does in effect blend between diffuse reflection and specular reflection.
Take varnished wood for instance. There is a transparent laquer coating over the wood. For rays near normal incidice the fresnel reflection term is small, so light is transmitted through the laquer layer until it hits the wood where it is then diffusely reflected. For large incidence angles however the rays are specularly reflected off the laquer-air interface.
A similar effect can be seen for plastic, which has a smooth air-solid interface over particles embedded in the plastic that reflect light diffusely.

 
TaskForce_Reivax

May 30, 2005, 07:42 AM

I never knew this before. The concept of plastic/varnished wood having a thin air-tight transparent layer on top of the underlying matte surface is so cool. Now that I think of it, it can be compared to a lake with clear, still water.

 
Billy Zelsnack

May 30, 2005, 02:12 PM

TaskForce, your gut feeling is correct. Daveperman said it the best. Specular is a hack to show the reflection of the light. It literally is that. Think of it this way. You can use a cubemap to mimic specular. What is a cubemap? A freak'n blurry picture of the light source that you are texture mapping on the object.

Ok. Here's my current theory I am pulling out of my ass. Everyone please let me know if I am full of it because I'd actually like to know myself.

In real-life there are NOT two types of interactions.. Diffuse and Specular. Those are hacks done to approximate what is going on.

In real-life only 3 things happen. A photon is created and goes flying off in a direction. It hits an object. That object can reflect the photon, it can absorb the photon, or it can refract the photon. That is it.

White-light contains photons of all wavelengths (colors). Depending on the properties of the object, the object absorbs only certain wavelengths, all others are reflection/refracted. (I don't think the photon actually is modified by a surface. Is that true?) If an object absorbs all the photons in the red/green wavelengths, all that is left to hit you in your eyeball is the blue wavelength photons, so that object appears blue. So if something looks blue.. It has a high probability of looking blue.

Now, about that specular hack part. That is basically used to model a reflection of the light-source in an object. The reason for this is a pixel is freak'n HUGE with respect to a photon/surface interaction. That pixel represents a huge number of surfaces pointing in all crazy directions (micro-facets some people like to call them). The odds of the surface reflecting directly into your tiny eyeball for whatever surface normal you chose for that pixel is pretty slim. A shiny object is just an object that's surface varies smoothly at the microscopic level making it so more photons hit you in the eye rather than going of in some random direction.

Also, I should mention.. Our eyes are highly tweaked to our environment with crazy non-linear brightness functions for certain wavelengths that make things appear as useful information to our brains. Because of that, it is ok to make a few hack here and there. Well, that and the speed problem. Doing the "real" simulation of all the photons for the Cornell box would probably take a computer the size of the Deathstar to compute in real-time.

 
Willem

May 31, 2005, 02:32 AM

The best derivation of the global illumination model from first principles I've ever read (ie., the balance equations. Like Billy said, a photon can interact with matter in only a couple of different ways) is due to James Arvo. It can be found here:

http://citeseer.csail.mit.edu/arvo93transfer.html

 
This thread contains 46 messages.
First Previous ( To view more messages, select a page: 0 1 ... out of 1) Next Last
 
 
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.