Simplify normal map sample, fix toy box normals. #320
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Mirror the toy-box texture to fix the normals.
Simplify the
box.ts
code.This was more complicated than it needed to be, and borrowed code from another project.
This code also used
vec3
methods with two-element vectors, which might cause issues with future versions ofwgpu-matrix
Simplfiy
normalMap.wgsl
const
declarations to name the various modes instead of magic literals.worldViewProj
andworldView
matrices on the CPU and pass them in as part of the uniform buffer. Reduces duplicated work in the vertex shader, and reduces the amount of data needed to be passed in.vec3f
for the light position instead of scalar. Pass in the position in view-space.tbn
totangent
,bitangent
andnormal
.when_greater
parallax_uv
into two functions.Rename
diffuse
textures toalbedo
. Technically a diffuse texture already has diffuse lighting applied.Fixed: #317