-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added raymarching reflect example. #7860
Conversation
Nice! http://ci.threejs.org/api/pullrequests/7860/examples/webgl_raymarching_reflect.html Consider using If you do so, you will have to add attribute vec3 position; to the vertex shader. |
mesh = new THREE.Mesh( geometry, material ); | ||
scene.add( mesh ); | ||
|
||
renderer = new THREE.WebGLRenderer(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should renderer.setPixelRatio( window.devicePixelRatio );
be added?
Added raymarching reflect example.
Nice! Thanks! |
@WestLangley Implemented your suggestions. However... I think it would be cool if, instead of passing |
Thank you for the comment and the merging! |
Agreed. @gam0022 Would you be willing to have a go at that? |
Yes, I got it. |
Is this alright? But screen began to black out by the cameraPos... |
It was solved by adding dummyCamera for renderer.render(). Do you think it is this a good ? |
function init() { | ||
|
||
scene = new THREE.Scene(); | ||
camera = new THREE.Camera(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm. I just realized you are instantiating a THREE.Camera()
and using a simplified vertex shader. This was also done in http://threejs.org/examples/webgl_shader.html. Personally, I would use an orthographic camera to render the quad, but your approach does appear to work...
@mrdoob -- Do you have an opinion on this?
I thank that there is no need to use the orthographic camera. |
In #7863, I used two cameras.
|
I assume you copied this from another example, but I expect this will be confusing to users. @greggman Have you seen this as a common technique for rendering a full-screen quad? (simplified vertex shader, careful positioniing of the quad so the projection matrix is not required) |
@WestLangley seems common to me. Isn't that what glslsandbox.com and shadertoy.com do? Isn't it also what http://threejs.org/examples/webgl_shader.html does? Or am I mis-understanding? |
@greggman It is what
At this point, I am no longer sure how that suggestion makes sense in the context of this example. |
Thank you for comments.
I now finally understand what you mean.
Yes, it is.
I think that there is some truth in what you says. |
Should I explain the above points at comments in |
My preference would be to use an orthographic camera. I am not sure it makes sense to pass the camera "position". |
The idea was to pass a camera into the shader, so the three world is more integrated with the raymarcher world. Ideally we could pass |
Thing is, there are no objects in the scene. This is just a full-screen quad with a shader rendererd on it. I do not feel strongly about this, but the whole thing to me is strange -- now that I think about it. |
Yes, but imagine that we wanted to animate the camera. We have a lot of code for animating stuff now. We can animate the camera outside instead of replicating animation code inside the shader. |
I added an example of raymarching reflect using
ShaderMaterial
.