Check out our latest project ✨ OpenChapter.io: free ebooks the way its meant to be 📖

Visual Shader Pixel Normal World Node

An asset by Foyezes
The page banner background of a mountain and forest
Visual Shader Pixel Normal World Node hero image

Quick Information

0 ratings
Visual Shader Pixel Normal World Node icon image
Foyezes
Visual Shader Pixel Normal World Node

This node outputs normal map direction in world space based on the input.

Supported Engine Version
4.0
Version String
1.0
License Version
MIT
Support Level
community
Modified Date
1 month ago
Git URL
Issue URL

Pixel Normal World Node For Godot

This is an addon for Godot 4 that adds the PixelNormalWorld node to the visual shader system. This node outputs normal map direction in world space based on the input.

README pixelnormalworld README worldspace

README p ixelnormal

Method

The normal map is unpacked from 0,1 to -1,1 range.

vec3 unpacked_normal = vec3(%s * 2.0 - 1.0);

TANGENT, BINORMAL & NORMAL is transformed into world space using AxB(3x3) matrix.

vec3 tangentWS = vec3((INV_VIEW_MATRIX * vec4(TANGENT, 0.0)).xyz);
    vec3 binormalWS = vec3((INV_VIEW_MATRIX * vec4(BINORMAL, 0.0)).xyz);
    vec3 normalWS = vec3((INV_VIEW_MATRIX * vec4(NORMAL, 0.0)).xyz);

A TBN matrix is constructed using world space TANGENT, BINORMAL & NORMAL.

mat4 TBN = mat4(vec4(tangentWS, 0.0), vec4(binormalWS, 0.0), vec4(normalWS, 0.0), vec4(0.0, 0.0, 0.0, 1.0));

The normal map is multiplied by the TBN matrix to get world space pixel normal direction.

%s = (TBN * vec4(unpacked_normal, 1.0)).xyz;

Installation

You can get it from the Asset Store in editor. Or extract the zip file and copy the folder to your project. You'll need to restart the editor for the node to appear in visual shader.

This node outputs normal map direction in world space based on the input.

Reviews

0 ratings

Your Rating

Headline must be at least 3 characters but not more than 50
Review must be at least 5 characters but not more than 500
Please sign in to add a review

Quick Information

0 ratings
Visual Shader Pixel Normal World Node icon image
Foyezes
Visual Shader Pixel Normal World Node

This node outputs normal map direction in world space based on the input.

Supported Engine Version
4.0
Version String
1.0
License Version
MIT
Support Level
community
Modified Date
1 month ago
Git URL
Issue URL

Open Source

Released under the AGPLv3 license

Plug and Play

Browse assets directly from Godot

Community Driven

Created by developers for developers