[BUG] Refraction

Feature requests, bug reports and related discussion
Deus
Posts: 336
Joined: Sun Feb 04, 2007 3:47 am

[BUG] Refraction

Post by Deus » Mon Feb 12, 2007 3:36 am

Well it seems to be some serious bugs when it comes to participating media.

This material should not show up at all if I recall my 5th grade math correctly. :) What am i doing wrong? Is the air IOR not exactly 1.0?

Still when I render a sphere i get a "darkening" and a dark thing at the bottom of the sphere.

Code: Select all

<medium>
		<name>voidmedium</name>
		<precedence>100</precedence>
			<basic>
			<ior>1.0</ior>
			<cauchy_b_coeff>0</cauchy_b_coeff>
			<absorption_coefficient_spectrum>
				<rgb>
					<rgb>0</rgb>
				</rgb>
			</absorption_coefficient_spectrum>
			</basic>
	</medium>

	<material>
		<name>void</name>
		<specular>
			<transparent>true</transparent>
			<internal_medium_name>voidmedium</internal_medium_name>
		</specular>
	</material>
What I was trying to do is one regular glass sphere at (0,0) r=1 with glass material and two spheres at (0,-1.001) & (0,1.001) r=1 with this null material. This would make me a concave lens if everything worked out as it should. It doesn't :(. It does not work at all. You would imagine that going from IOR 1 to IOR 1.5 would yield something that would be like a glass surface ;-)

I am using latest test.

Here is a sample scene.

Code: Select all

	<medium>
		<name>glassmedium</name>
		<precedence>10</precedence>
			<basic>
			<ior>1.5</ior>
			<cauchy_b_coeff>0</cauchy_b_coeff>
			<absorption_coefficient_spectrum><rgb><rgb>0</rgb></rgb></absorption_coefficient_spectrum>
			</basic>
	</medium>

	<medium>
		<name>voidmedium</name>
		<precedence>100</precedence>
			<basic>
			<ior>1.0</ior>
			<cauchy_b_coeff>0</cauchy_b_coeff>
			<absorption_coefficient_spectrum><rgb><rgb>0</rgb></rgb></absorption_coefficient_spectrum>
			</basic>
	</medium>

	<material>
		<name>glass</name>
		<specular>
			<transparent>true</transparent>
			<internal_medium_name>glassmedium</internal_medium_name>
		</specular>
	</material>

	<material>
		<name>void</name>
		<specular>
			<transparent>true</transparent>
			<internal_medium_name>voidmedium</internal_medium_name>
		</specular>
	</material>
	
	<sphere>
		<center>0 -1.01 1.01</center>
		<radius>1</radius>
		<material_name>void</material_name>
	</sphere>

	 <sphere>
		<center>0 0 1.01</center>
		<radius>1</radius>
		<material_name>glass</material_name>
	</sphere>

	<sphere>
		<center>0 1.01 1.01</center>
		<radius>1</radius>
		<material_name>void</material_name>
	</sphere>

Am I doing something wrong or is it a bug?

Joy joy happy

/ Deus

User avatar
OnoSendai
Developer
Posts: 6243
Joined: Sat May 20, 2006 6:16 pm
Location: Wellington, NZ
Contact:

Post by OnoSendai » Mon Feb 12, 2007 3:47 am

Can you post some images?

User avatar
Kram1032
Posts: 6649
Joined: Tue Jan 23, 2007 3:55 am
Location: Austria near Vienna

Post by Kram1032 » Mon Feb 12, 2007 3:51 am

air: (near to sea level) IOR = 1,000292
vakuum: IOR = 1 ;)

Deus
Posts: 336
Joined: Sun Feb 04, 2007 3:47 am

Post by Deus » Mon Feb 12, 2007 3:54 am

I got no hosting. Ill try sir.

One sphere

Image

The three spheres (should be a concave lens)

Image

If you want to fiddle around with it. Use your testscenes/bumpmap_test.xml as base Ono. I used that one changed texture to repeat more and checkers on both planes. and just paste in my second scene desc above

Here is correct logic

Code: Select all

Onintersect()
if( newmediaprecedence > currentmediaprecedence )
{
  If (my russian roulette tells me to do a refraction ray)
  {
     ior = newmediumior/oldmediumior;
     if( in_ang / ior > PI/2 )
       totalinternalreflection
     else
      give me my damn concavelens
  }
  else do a diffuse ray or something equally pointless
}

}

/ Deus
Last edited by Deus on Mon Feb 12, 2007 4:00 am, edited 2 times in total.

Deus
Posts: 336
Joined: Sun Feb 04, 2007 3:47 am

Post by Deus » Mon Feb 12, 2007 3:55 am

Kram I would never care for that many decimals neither would Ono :)

User avatar
Kram1032
Posts: 6649
Joined: Tue Jan 23, 2007 3:55 am
Location: Austria near Vienna

Post by Kram1032 » Mon Feb 12, 2007 3:59 am

This material should not show up at all if I recall my 5th grade math correctly. Smile What am i doing wrong? Is the air IOR not exactly 1.0?
Maths is an exact science!
And you wanted to know if it's exactly 1.0!
It's not ^^ :o :D 8) :D

Deus
Posts: 336
Joined: Sun Feb 04, 2007 3:47 am

Post by Deus » Mon Feb 12, 2007 4:01 am

It was a hypothetical question I know its not 1. I am number one so the IOR cant be it. 8)

User avatar
OnoSendai
Developer
Posts: 6243
Joined: Sat May 20, 2006 6:16 pm
Location: Wellington, NZ
Contact:

Post by OnoSendai » Mon Feb 12, 2007 4:03 am

Make sure the camera doesn't intersect any of the spheres (known bug)
Other than that, i'm not sure what's causing the artifacts, perhaps u could post the whole scene?

Deus
Posts: 336
Joined: Sun Feb 04, 2007 3:47 am

Post by Deus » Mon Feb 12, 2007 4:06 am

Here you go sir. I ripped off your testscene as I said. Camera does not intersect. Its the MLT (Meskalin Light Trickery) thats pulling your leg Ono ;-)

Hope you fix it. Will fix _alot_ of render problems. If you want the three speres scene you need to remove the comment around the two second spheres.

Completely unrelated. I can really tell a difference with your new KD-tree optimizations. Good work.

Code: Select all

<?xml version="1.0" encoding="utf-8"?>

<scene>

	<renderer_settings>
		<width>480</width>
		<height>480</height>
	</renderer_settings>


	<tonemapping>
		<reinhard>
			<pre_scale>1.0</pre_scale>
			<post_scale>1.0</post_scale>
		</reinhard>
		<!--linear>
			<scale>200.0</scale>
		</linear-->
	</tonemapping>

	<!-- The material we are previewing -->


	<camera>
		<pos>0 -5.2 2.5</pos>
		<up>0 0 1</up>
		<forwards>0 1 -0.3</forwards>
		
		<focus_distance>2.000000</focus_distance>
		<aspect_ratio>1</aspect_ratio>
		<aperture_radius>0.001</aperture_radius>
		<sensor_width>0.036</sensor_width>
		<lens_sensor_dist>0.04</lens_sensor_dist>
		<white_balance>D65</white_balance>
	</camera>

	<rectanglelight>
		<pos>0 0 7.5</pos>
		<width>17.5</width>
		<height>10</height>
		<spectrum>  
			<blackbody>
				<temperature>6500</temperature>
				<gain>0.00001</gain>
			</blackbody>
		</spectrum>
	</rectanglelight>


	<!-- Ground Material -->

	<material>
		<name>white</name>
		
		<diffuse>
			<colour>1 1 1</colour>
		</diffuse>    
	</material>
	
	<material>
		<name>checker</name>
		
		<diffuse>
			<colour>1 1 1</colour>	
			<albedo_texture>
				<uv_set>albedo</uv_set>
				<path>testscenes/checker.jpg</path>
				<b>1.0</b>
				<exponent>2.3</exponent>
			</albedo_texture>	
		</diffuse>    
	</material>

	<material>
		<name>checkerred</name>
		
		<diffuse>
			<colour>1 0.4 0.1</colour>	
			<albedo_texture>
				<uv_set>albedo</uv_set>
				<path>testscenes/checker.jpg</path>
				<b>1.0</b>
				<exponent>2.3</exponent>
			</albedo_texture>	
		</diffuse>    
	</material>


	<medium>
		<name>glassmedium</name>
		<precedence>10</precedence>
			<basic>
			<ior>1.5</ior>
			<cauchy_b_coeff>0</cauchy_b_coeff>
			<absorption_coefficient_spectrum><rgb><rgb>0</rgb></rgb></absorption_coefficient_spectrum>
			</basic>
	</medium>

	<medium>
		<name>voidmedium</name>
		<precedence>100</precedence>
			<basic>
			<ior>1.000001</ior>
			<cauchy_b_coeff>0</cauchy_b_coeff>
			<absorption_coefficient_spectrum><rgb><rgb>0</rgb></rgb></absorption_coefficient_spectrum>
			</basic>
	</medium>

	<material>
		<name>glass</name>
		<specular>
			<transparent>true</transparent>
			<internal_medium_name>glassmedium</internal_medium_name>
		</specular>
	</material>

	<material>
		<name>void</name>
		<specular>
			<transparent>true</transparent>
			<internal_medium_name>voidmedium</internal_medium_name>
		</specular>
	</material>
	
	<sphere>
		<center>0 -1.01 1.01</center>
		<radius>1</radius>
		<material_name>void</material_name>
	</sphere>

	<!--- <sphere>
		<center>0 0 1.01</center>
		<radius>1</radius>
		<material_name>glass</material_name>
	</sphere>

	<sphere>
		<center>0 1.01 1.01</center>
		<radius>1</radius>
		<material_name>void</material_name>
	</sphere> --->

		
	<!-- Define a Mesh -->
	<mesh>
		<name>mesh1</name>
	
		<normal_smoothing>false</normal_smoothing>
		<embedded>
			<expose_uv_set>
				<index>0</index>
				<name>albedo</name>
			</expose_uv_set>
				
			<expose_uv_set>
				<index>0</index>
				<name>bump</name>
			</expose_uv_set>
			
			<vertex pos="-10 -10 0" normal="0 0 1" uv0="0 0" />
			<vertex pos="-10 10 0" normal="0 0 1" uv0="0 20" />
			<vertex pos="10 10 0" normal="0 0 1" uv0="20 20" />
			<vertex pos="10 -10 0" normal="0 0 1" uv0="20 0" />
				
			<triangle_set>						
				<material_name>checkerred</material_name>
				<tri>0 1 2</tri>
				<tri>0 2 3</tri>
			</triangle_set>
			
			<vertex pos="-10 3 0" normal="0 -1 1" uv0="0 0" />
			<vertex pos="-10 3 20" normal="0 -1 1" uv0="0 20" />
			<vertex pos="10 3 20" normal="0 -1 1" uv0="20 20" />
			<vertex pos="10 3 0" normal="0 -1 1" uv0="20 0" />
				
			<triangle_set>						
				<material_name>checker</material_name>
				<tri>4 5 6</tri>
				<tri>4 6 7</tri>
			</triangle_set>
		</embedded>
	</mesh>
	
	<model>
		<pos>0 0 0</pos>
		<scale>1.0</scale>
		<mesh_name>mesh1</mesh_name>
	</model>
	

</scene>


User avatar
OnoSendai
Developer
Posts: 6243
Joined: Sat May 20, 2006 6:16 pm
Location: Wellington, NZ
Contact:

Post by OnoSendai » Mon Feb 12, 2007 4:11 am

Works fine for me...
Can u post ur inifile as well?

Deus
Posts: 336
Joined: Sun Feb 04, 2007 3:47 am

Post by Deus » Mon Feb 12, 2007 4:13 am

Code: Select all


"scenefilepath" "myconcavelens.xml"
--"scenefilepath" "G:/Source/indigoworld/myscene.xml"  -- This line will get your juices flowing Ono :)

	--Scene xml file to load.  Relative to working directory (e.g. indigo.exe path)
	--Alternatively, this path can be an absolute path, eg c:\indigo_scenes\testscene.xml
	
	

------Output image dimensions------
"width"  "1280"                          --Note that the ratio of these should match the camera aspect ratio defined
"height" "960"                          -- in the scene xml file.

------Metropolis light transport settings------
"metropolis" "true"                     --if true, use MLT, if false, use pathtracer

"large_mutation_prob" "0.4"             --Probability of using fresh random numbers.
"max_change" "0.01"                     --max mutation size, must be in range [min_change, 1)
"max_num_consec_rejections" "1000"

------General tracing parameters------
--"russian_roulette_live_prob" "0.1"     --0.7 
"max_depth" "3"                      --max ray bounce depth.
"bidirectional" "false"

------Path tracer settings------
--"strata_width" "2"                     --number of samples per pixel = strata_width*strata_width

------Network rendering settings-----
"frame_upload_period" "20.0"              --number of seconds between uploads of image to network master

------Miscellaneous settings-----
"halt_time" "-1"
"logging" "true"                        --write to log.txt?
"display_period" "20.0"                --number of seconds between display of the render in preview window.
"image_save_period" "20.0"              --number of seconds between saves of the render to PNG and EXR.
"save_tonemapped_exr" "false"           --Write .exr tonemapped render as well as normal PNG?
"save_untonemapped_exr" "false"         --Write .exr untonemapped render as well as normal PNG?
"num_threads" "1"
"cache_trees" "true"
"polarisation" "false"
"super_sample_factor" "1"             --a higher value takes more RAM but may reduce aliasing.



User avatar
OnoSendai
Developer
Posts: 6243
Joined: Sat May 20, 2006 6:16 pm
Location: Wellington, NZ
Contact:

Post by OnoSendai » Mon Feb 12, 2007 4:16 am

Code: Select all

"max_depth" "3"
There's your problem :)

edit: Indigoworld :shock: ?
Last edited by OnoSendai on Mon Feb 12, 2007 4:16 am, edited 1 time in total.

Deus
Posts: 336
Joined: Sun Feb 04, 2007 3:47 am

Post by Deus » Mon Feb 12, 2007 4:16 am

Oops i found error. Max depth right? (Now thats embarrasing ;-) )

Deus
Posts: 336
Joined: Sun Feb 04, 2007 3:47 am

Post by Deus » Mon Feb 12, 2007 4:19 am

Indigoworld is a little project of mine. Ill post images (and maybe even executables) when I get a tad further.

User avatar
OnoSendai
Developer
Posts: 6243
Joined: Sat May 20, 2006 6:16 pm
Location: Wellington, NZ
Contact:

Post by OnoSendai » Mon Feb 12, 2007 4:20 am

Executables? :)
look forward to it.

Post Reply
22 posts

Who is online

Users browsing this forum: No registered users and 1 guest