-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Smaller improvements, add instancing effect
- Loading branch information
Showing
10 changed files
with
50 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
# Terrain effect | ||
# This effect uses prodecural shader splatting, you most likely want to modify | ||
# it with your own texture-map generation code. | ||
|
||
vertex: | ||
inout: | | ||
uniform samplerBuffer InstancingData; | ||
transform: | | ||
int data_index = gl_InstanceID * 4; | ||
vec4 data_0 = texelFetch(InstancingData, data_index); | ||
vec4 data_1 = texelFetch(InstancingData, data_index + 1); | ||
vec4 data_2 = texelFetch(InstancingData, data_index + 2); | ||
vec4 data_3 = texelFetch(InstancingData, data_index + 3); | ||
mat4 transform_mat = mat4(data_0, data_1, data_2, data_3); | ||
vOutput.position = (transform_mat * p3d_Vertex).xyz; | ||
// Also transform normal, not 100% correct but works out nicely | ||
vOutput.normal = mat3(transform_mat) * vOutput.normal; | ||
fragment: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters