Question: Why not use same floating point number in common.glsl.js
See original GitHub issueI think it will be better, why not use same floating point number in common.glsl.js
--- a/src/renderers/shaders/ShaderChunk/common.glsl.js
+++ b/src/renderers/shaders/ShaderChunk/common.glsl.js
@@ -1,9 +1,9 @@
export default /* glsl */`
#define PI 3.14159265359
#define PI2 6.28318530718
-#define PI_HALF 1.5707963267949
+#define PI_HALF 1.570796326795
#define RECIPROCAL_PI 0.31830988618
-#define RECIPROCAL_PI2 0.15915494
+#define RECIPROCAL_PI2 0.15915494309
#define LOG2 1.442695
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
GLSL - Using an attribute which is equal to a number, is not ...
GLSL - Using an attribute which is equal to a number, is not the same as directly using the number · Ask Question....
Read more >WebGL Precision Issues
For floating point values they can range from: -2 to +2, for integer values ... be used everywhere, is often not high enough...
Read more >Image Format - OpenGL Wiki - Khronos Group
Color formats can be stored in one of 3 ways: normalized integers, floating-point, or integral. Both normalized integer and floating-point ...
Read more >GLSL Shaders - Game development - MDN Web Docs
Shaders use GLSL (OpenGL Shading Language), a special OpenGL Shading Language with syntax ... GLSL is not as intuitive as JavaScript.
Read more >Shaders - LearnOpenGL
GLSL is tailored for use with graphics and contains useful features specifically ... We're not using this uniform in the vertex shader so...
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
Just remember that glsl currently is precision limited to float32 or lower, where as JavaScript uses doubles for all mathematical calculations. Thus JavaScript’s Math.PI and other math constants will have more precision than needed for GLSL. Probably don’t hurt though as GLSL probably just truncates.
I am okay with removing EPSILON. I had a friend in university who could analyze any floating point calculation and tell you the exact epsilon you should use in that case. But it is a lot of work to do that on a per mathematical equation basis.