question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Refraction with custom geometry

See original GitHub issue
Description of the problem

Hello,

I noticed an issue with the Refraction example :

https://threejs.org/examples/?q=refr#webgl_refraction

If I change the plane by a box and rotate it, some times the shader show weird things :

image

Modifications of the example :

Line 81 : var refractorGeometry = new THREE.BoxBufferGeometry( 4, 4, 4 );

function render() { 

	refractor.material.uniforms.time.value += clock.getDelta();

	refractor.rotation.y += 0.02;

	renderer.render( scene, camera );

}
Three.js version
  • r94
Browser
  • All of them
OS
  • All of them

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Mugen87commented, Jul 3, 2018

The algorithm of Reflector and Refractor assumes there is a single reflection/refraction plane. I think you need a different approach if you want to support an arbitrary amount of planes defined by a group of planar polygon faces.

1reaction
mrdoobcommented, Jul 3, 2018

@mrdoob Should I correct your edit? 😉

Hehe, ops! I tried to make it more clear. I should have said PlaneGeometry, CircleGeometry, ShapeGeometry, …

Read more comments on GitHub >

github_iconTop Results From Across the Web

Shiny Refraction - Three.js Tutorials
This example demonstrates,. Using the EffectComposer to add a Depth of Field (DOF) effect. Dynamically changing the DOF depending on camera and ball ......
Read more >
Using Refraction | Unreal Engine Documentation
Refraction is the term used to describe the change in direction of a light wave due to a change in its transmission medium....
Read more >
Chapter 19. Generic Refraction Simulation - NVIDIA Developer
The first step of the basic refraction technique is to render the scene geometry into a texture, skipping all refractive meshes. This texture...
Read more >
Refraction Rendering
Refraction. Screenshot: RefractionSample. Material. The Dude models in the RefractionSample are rendered using a custom effect. Here is one of the materials ...
Read more >
Simulating refraction in SceneKit - ios - Stack Overflow
To make it clear, what I'm trying to achieve here is having a 3d lens in a scene which you can look through...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found