Results 1 to 3 of 3

Thread: Volume Rendering Artifacts

  1. #1
    Junior Member Newbie
    Join Date
    Mar 2015
    Posts
    20

    Volume Rendering Artifacts

    Hi all,

    I have encountered some rendering artifacts in volume rendering as below:

    artifacts.jpg artifacts2.jpg

    A you probably notice it, there is black halo at the edge of the rendered image when view from certain angle.
    FYI, code snippet of main function of fragment shader is as below(retrived from OpenGL Development Cookbook):
    Code :
    void main()
    { 
    	//get the 3D texture coordinates for lookup into the volume dataset
    	vec3 dataPos = vUV;
     
    	vec3 geomDir = normalize((vec3(0.556,0.614,0.201)*vUV-vec3(0.278,0.307,0.1005)) - camPos); 
     
    	vec3 dirStep = geomDir * step_size; 	
     
    	//flag to indicate if the raymarch loop should terminate
    	bool stop = false; 
     
    	//for all samples along the ray
    	for (int i = 0; i < MAX_SAMPLES; i++) {
    		// advance ray by dirstep
    		dataPos = dataPos + dirStep;
     
    		stop = dot(sign(dataPos-texMin),sign(texMax-dataPos)) < 3.0f;
     
    		//if the stopping condition is true we brek out of the ray marching loop
    		if (stop) 
    			break;
     
    		// data fetching from the red channel of volume texture
    		float sample = texture(volume, dataPos).r;	
     
     
    		float prev_alpha = sample - (sample * vFragColor.a);
    		vFragColor.rgb = (prev_alpha) * vec3(sample) + vFragColor.rgb; 
    		vFragColor.a += prev_alpha; 
     
     
    		if( vFragColor.a>0.99)
    			break;
    	}

    FYI, the volume data is not similar in dimension, thus, some operation is done to make sure the coordinates do maps to the texture coordinates.
    (vec3(0.556,0.614,0.201)*vUV-vec3(0.278,0.307,0.1005)
    So, what probably could result in this artifacts???

  2. #2
    Junior Member Newbie
    Join Date
    Mar 2015
    Posts
    20
    FYI, the artifacts appear when viewing at the edge of the cuboid.....

  3. #3
    Junior Member Newbie
    Join Date
    Mar 2015
    Posts
    20
    Quote Originally Posted by vincent911001 View Post
    FYI, the artifacts appear when viewing at the edge of the cuboid.....
    The problem is solved by changing the interpolation parameter of mipmapping to GL_LINEAR from GL_LINEAR_MIPMAP_LINEAR.....

Similar Threads

  1. 3D texture rendering artifacts
    By vincent911001 in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 04-07-2015, 07:54 PM
  2. Odd artifacts when rendering to FBO
    By Duncan Champney in forum OpenGL: Basic Coding
    Replies: 14
    Last Post: 03-22-2008, 07:54 PM
  3. moire patterns / woodgrain artifacts - Volume renderer
    By seen in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 01-14-2007, 03:33 AM
  4. Strange rendering artifacts...
    By dagcrack in forum OpenGL: Basic Coding
    Replies: 8
    Last Post: 04-18-2005, 04:58 AM
  5. Strange Rendering Artifacts
    By azcoder in forum OpenGL: Advanced Coding
    Replies: 8
    Last Post: 06-30-2004, 04:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean