generated from nathanfranke/gdextension
-
Notifications
You must be signed in to change notification settings - Fork 126
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
Shader optimizations #26
Labels
Milestone
Comments
TokisanGames
added
enhancement
New feature or request
good first issue
Good for newcomers
labels
Jan 28, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Performance
terrain_size_inv
rather than in the shader. WIll save millions of divides per second.Terrain3D/src/terrain_material.cpp
Line 98 in 0bb046e
https://docs.godotengine.org/en/latest/tutorials/shaders/shader_reference/shading_language.html
e.g.
https://github.com/outobugi/GDExtensionTerrain/blob/0bb046eb2e0da0c137e91f74215f574f353f95fb/src/terrain_material.cpp#L73
https://github.com/outobugi/GDExtensionTerrain/blob/0bb046eb2e0da0c137e91f74215f574f353f95fb/src/terrain_material.cpp#L80
https://github.com/outobugi/GDExtensionTerrain/blob/0bb046eb2e0da0c137e91f74215f574f353f95fb/src/terrain_material.cpp#L141
Maybe also make an FMA macro that uses fma or
*+
depending on compatibility or notLookup region only once per vertex. Move into vertex() and save as a varrying for the colormap in fragment.- Looks bad on lower LODs when using this to calculate pixel data as the vertices are far apart.texturegrad
withtexture
, if we don't need it for 3D Projection. See Fragment & Texture Normals are wrong #169 update 2 and Fragment & Texture Normals are wrong #169 (comment)https://community.khronos.org/t/if-statements-in-shaders-confused-by-results/73518/15
Since we're blending 4 adjacent vertices, move lookups to vertex() and weight in fragment.- Doesn't look good on lower LODs as the vertices are farther apart, but see redesign below.Functional
Firefly artifacts along seams between perfectly aligned meshes godotengine/godot#35067 (comment)
Sometimes I've had the need for antialiasing and have typically faded out (vertex grid, macrovariation) instead of aliasing. Perhaps anti-aliasing is better.
https://stackoverflow.com/questions/20204561/advanced-moir%C3%A9-a-pattern-reduction-in-hlsl-glsl-procedural-textures-shader-a
https://www.yaldex.com/open-gl/ch17lev1sec4.html#ch17fig04
https://bgolus.medium.com/normal-mapping-for-a-triplanar-shader-10bf39dca05a
Redesign
The text was updated successfully, but these errors were encountered: