View Issue Details

IDProjectCategoryView StatusLast Update
0024864Open CASCADEOCCT:Visualizationpublic2014-11-11 12:58
ReporterdbpAssigned Toapn  
PrioritynormalSeverityfeature 
Status closedResolutionfixed 
Target Version6.8.0Fixed in Version6.8.0 
Summary0024864: Visualization - Implementing refractions in ray-tracing
DescriptionFor transparent objects implemented ray refraction according to refraction index.
Refraction index passed to raytrace shader. Transparent materials have been modified to look better with refractions.
Additional information
and documentation updates
Optical refractions according to specified refraction index have been implemented for transparent objects (in OCCT ray-tracing core). Transparent materials have been modified to look better with refractions ('water', 'glass' and 'diamond').
TagsNo tags attached.
Test case numberNot needed

Attached Files

  • refraction.png (18,855 bytes)

Relationships

related to 0024855 closedapn Open CASCADE Revision of parameters of standard materials 
related to 0023387 closedbugmaster Community Visualization - transparency of specified material is ignored within AIS_Shape::SetMaterial() 
related to 0024887 closedapn Open CASCADE Visualization - revise and extend Raytracing controls 

Activities

dbp

2014-04-22 10:29

developer   ~0029004

Dear duv,

please use this base fucntion:

// =======================================================================
// function : Refract
// purpose :
// =======================================================================
vec3 Refract (in vec3 theInput, in vec3 theNormal)
{
  float aNdotI = dot (theInput, theNormal);
  
  float anIndex = aNdotI < 0.0
                ? 1.0 / 1.5
                : 1.5 / 1.0;
                
  float aSquare = anIndex * anIndex * (1.0 - aNdotI * aNdotI);
  
  if (aSquare > 1.0)
  {
    return reflect (theInput, theNormal);
  }

  vec3 aOut = (aNdotI < 0.0)
    ? anIndex * theInput - (anIndex * aNdotI + sqrt (1.0 - aSquare)) * theNormal
    : anIndex * theInput - (anIndex * aNdotI - sqrt (1.0 - aSquare)) * theNormal;

  return normalize (aOut);
}

duv

2014-05-13 16:14

developer   ~0029300

Dear kgv,

please review the patch.

kgv

2014-05-14 08:27

developer   ~0029311

Last edited: 2014-05-14 08:27

Dear Danila,

     vec4 aSpecular = vec4 (texelFetch (
       uRaytraceMaterialTexture, MATERIAL_SPEC (aTriIndex.w)));
-    vec2 aOpacity = vec2 (texelFetch (
+    vec4 aOpacity = vec4 (texelFetch (
       uRaytraceMaterialTexture, MATERIAL_TRAN (aTriIndex.w)));

could you please specify what for all these "vec4(texelFetch("? I think vec4 constructor is redundant here.

+      theInverse.z = theRay.Direct.z < 0.0 ? -theInverse.z : theInverse.z;
+      
+      aPoint += aHit.Normal * (dot (aHit.Normal, theRay.Direct) >= 0.f ? uSceneEpsilon : -uSceneEpsilon);

it would be better to use same style across the code (">= 0.0" instead of ">= 0.f")...

duv

2014-05-14 10:45

developer   ~0029312

Dear kgv,

please review the patch.

kgv

2014-05-16 14:01

developer   ~0029370

Please test the patch.

apv

2014-05-22 16:14

tester   ~0029469

Last edited: 2014-05-22 16:18

Dear BugMaster,

Branch CR24864 (and products from GIT master) was compiled on Linux and Windows platforms and tested.
SHA-1: 6e734e8b572450ed07ae6eb4e838f647b54e877c

Number of compiler warnings:

Linux: 17 (17 on master)
Windows: 0 (0 on master)

products component :
Linux: 11 (11 on master)
Windows: 2 (2 on master)

Regressions/Differences:
Not detected

Testing cases:
Absent

Testing on Linux:
Total MEMORY difference: 355730320 / 357316044
Total CPU difference: 59822.65999999958 / 56363.22999999993

Testing on Windows:
Total MEMORY difference: 379211864 / 379613888
Total CPU difference: 39919.71875 / 35503.203125

kgv

2014-06-30 08:15

developer  

refraction.png (18,855 bytes)

Related Changesets

occt: master dc9ef964

2014-04-22 12:55:21

duv


Committer: apn Details Diff
0024864: Implementing refractions in ray-tracing

Refraction index passed to raytrace shader.
For transparent objects implemented ray refraction according to refraction index.
Transparent materials modified to look better with refractions.
Affected Issues
0024864
mod - src/Graphic3d/Graphic3d_Group.cxx Diff File
mod - src/OpenGl/OpenGl_Workspace_Raytrace.cxx Diff File
mod - src/Shaders/RaytraceBase.fs Diff File
add - tests/v3d/raytrace/refraction Diff File

Issue History

Date Modified Username Field Change
2014-04-21 17:47 dbp New Issue
2014-04-21 17:47 dbp Assigned To => dbp
2014-04-22 10:28 dbp Assigned To dbp => duv
2014-04-22 10:29 dbp Note Added: 0029004
2014-04-22 17:07 duv Status new => assigned
2014-04-23 10:24 kgv Severity minor => feature
2014-04-23 10:24 kgv Product Version 6.8.0 =>
2014-04-23 10:24 kgv Target Version => 6.8.0
2014-04-23 10:24 kgv Summary Implementing refractions in ray-tracing => Visualization - Implementing refractions in ray-tracing
2014-04-25 15:04 san Relationship added related to 0024855
2014-04-25 15:04 san Relationship added related to 0023387
2014-05-13 16:13 duv Description Updated
2014-05-13 16:14 duv Note Added: 0029300
2014-05-13 16:14 duv Assigned To duv => kgv
2014-05-13 16:14 duv Status assigned => resolved
2014-05-14 08:27 kgv Note Added: 0029311
2014-05-14 08:27 kgv Assigned To kgv => duv
2014-05-14 08:27 kgv Status resolved => assigned
2014-05-14 08:27 kgv Note Edited: 0029311
2014-05-14 10:45 duv Note Added: 0029312
2014-05-14 10:45 duv Assigned To duv => kgv
2014-05-14 10:45 duv Status assigned => resolved
2014-05-16 14:01 kgv Note Added: 0029370
2014-05-16 14:01 kgv Assigned To kgv => bugmaster
2014-05-16 14:01 kgv Status resolved => reviewed
2014-05-20 10:18 kgv Relationship added related to 0024887
2014-05-21 16:52 apn Assigned To bugmaster => apn
2014-05-22 16:14 apv Note Added: 0029469
2014-05-22 16:15 apv Assigned To apn => bugmaster
2014-05-22 16:15 apv Status reviewed => tested
2014-05-22 16:18 apn Note Edited: 0029469
2014-05-22 16:19 apn Test case number => Not needed
2014-05-23 14:25 apn Changeset attached => occt master dc9ef964
2014-05-23 14:25 apn Assigned To bugmaster => apn
2014-05-23 14:25 apn Status tested => verified
2014-05-23 14:25 apn Resolution open => fixed
2014-06-30 08:15 kgv File Added: refraction.png
2014-09-29 14:17 dbp Description Updated
2014-09-29 14:17 dbp Additional Information Updated
2014-11-11 12:45 aiv Fixed in Version => 6.8.0
2014-11-11 12:58 aiv Status verified => closed