Page 1 of 1

Patch for OSA problems !!!

Posted: Wed Aug 27, 2003 4:39 pm
by rwenzlaff
I discovered that the OSA problems Blender experiences are only apparent when the (spec+ref) settings of a background object total more than 1.00.

This kind of makes sense. Since spec and ref are supposed to be the % of light reflected specularly, and diffusely, They should never total more than 1.00. (It's interesting that Blender's default material reflects 130% of the light that falls on it.)

So if the background object is reflecting more light than it recieves, it makes sense that its samples in the OSA sum are weighted too high. Setting spec=2 and ref=1 escentially turns off OSA for those edges, since the background is outweighed up to 3:1. I think just clipping the OSA contribution of any face to 1.00 will solve this. A better solution might be to apply some kind of gamma function to the contribution.

I'll look tonight to see if I can find the spot in the code to do this.

EDIT: Did it. A simple change to pixelblending.c seems to fix this. I also added a button to turn it off to test to make sure I didn't introduce any other artifacts.

http://www.soylent-green.com/ClipOSA.patch


Det. Thorn

Posted: Wed Aug 27, 2003 6:40 pm
by rwenzlaff
BTW: Heres a file that shows what I mean:

http://www.soylent-green.com/AA.blend

Play with the spec and ref settings of the "white" material.

TTFN

Posted: Fri Aug 29, 2003 5:09 am
by rwenzlaff
I put it at the top, too, but

http://www.soylent-green.com/ClipOSA.patch

Posted: Sat Aug 30, 2003 4:14 pm
by soletread
This is a great investgative effort. !!!

Well done. :o

Will this patch make the 2.29 release?

------------

Posted: Sat Aug 30, 2003 8:26 pm
by z3r0_d
but blender is not the real world, why should I care about inaccuracies it has?

(though the blending should be bounded before the blending, if that is the problem)

so: don't change my material settings, try to fix the problem before the values are blended. (instead of as they are converted to rgb)

Posted: Mon Sep 01, 2003 8:42 am
by rwenzlaff
z3r0_d wrote:but blender is not the real world, why should I care about inaccuracies it has?
Cause it looks terrible???? You like jagged edges? Feel free to turn OSA off.
z3r0_d wrote: (though the blending should be bounded before the blending, if that is the problem)
so: don't change my material settings, try to fix the problem before the values are blended. (instead of as they are converted to rgb)
The problem comes from the fact that internally blender was using a number greater than 1, but it can't display anything brighter than that.
A color value of 1.0 converts to 0xff.

Before if a pixel was 1/2 intensity 0.8, and 1/2 intensity 1.3, the average came out to 1.05 which was clipped to 1.0. Since the face that was 1.3 is really shown as 1.0, this means the darker face's contribution was wiped out. The pixel escentially had OSA turned off and rendered with a jagged edge.

With my patch, the 0.8 contributes as normal, but the 1.3 only contributes 1.0 (because this is what it really gets displayed as). The average is 0.9 which is exactly the color you'd expect for a pixel that is 1/2 0.8 and 1/2 1.0 (as displayed).

Det Thorn