Famous / Famous/engine

Normal offset application in vertex shader?

Open
#250 4 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
1.7k
Forks
249
PR merge metrics
No merged PRs in 30d

Description

This line should be in the fragment shader.

```
vec3 invertedNormals = a_normals + (u_normals.x < 0.0 ? calculateOffset(u_normals) * 2.0 - 1.0 : vec3(0.0));
```

Which requires some refactors to the vertex shader.

This will apply the normal texture on a per fragment basis versus a per vertex basis, which makes a lot more sense for textures.

TLDR: If you don't have enough vertices it looks like this:
![screen shot 2015-06-08 at 12 38 37 pm](https://cloud.githubusercontent.com/assets/5566649/8043556/cae51628-0ddb-11e5-8145-0afac1e71102.png)
When it should look like this:
![screen shot 2015-06-08 at 12 38 56 pm](https://cloud.githubusercontent.com/assets/5566649/8043552/c47c8320-0ddb-11e5-9305-30e37711f51e.png)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.