OrthographicCamera and GLSL rendering issue
See original GitHub issueDescription of the problem
When generating a square mesh (using ShapeGeometry
) with a ShaderMaterial
(barebones GLSL shader) in a scene with an OrthographicCamera
it is neither at the right origin nor the right scale. This is not the case using any other material.
https://jsfiddle.net/h3m951x6/1/
Three.js version
- [ x] r116
Browser
- All of them
OS
- All of them
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (4 by maintainers)
Top Results From Across the Web
Texture is rendering as white at some specific orthographic camera ...
Hello! Im having a curious problem with my textures that a searched literally in all related topics and can't solve by myself. Im...
Read more >LibGDX Orthographic camera not rendering at certain angles
The camera only renders elements between the near and far planes. OpenGL near and far planes. The default values are 0 (near) and...
Read more >[Solved] OpenGL shows nothing - LWJGL Forum
I have a problem while trying to render a triangle with OpenGL using LWJGL. ... a simple orthographic camera at the position (0|0|1)....
Read more >A Simple Method to Render an Image | HackLAB - Geeks3D
To render an image, we need an orthographic camera, a texture GPU program, a quad and the image (a texture). Here is how...
Read more >Creating an Orthographic Camera | Game Engine series
Creating an Orthographic Camera | Game Engine series. 34K views 3 years ago ... GRASS RENDERING in OpenGL // Code Review. The Cherno....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The generated geometry is not centered, so it won’t appear centered eitherway. You are assigning the vertex position in object space directly to
gl_Position
, so the object doesn’t follow the rendering pipeline and it won’t be based on the camera’s configuration or world coordinates.This is not an issue with Three.js, I suggest taking a look at the examples and/or opening a thread on the Three.js Discourse Forum for help.
Thanks @sciecode .
I did look at examples my
OrthographicCamera
should be in line with a top left origin of my canvas as documented here and I set the vertex position in object space as demonstrated here line 22.There was nothing in my post to suggest that the geometry needs to be centered – its origin needs to be in line with my canvas coordinates. I’ll open up a thread on the forum. In the future, I’d encourage you to heed your own advice by taking a look at some examples.
@mrdoob thoughts?