(?) Using World Position Textures

Just curious, is there any way to use a baked world position texture to affect the shading of a material, vs using the vertices position to calculate shading?

I’d like to create an effect using world normal and world position textures to achieve a stylized npr effect, but I don’t know if it’s even possible in the current builds of blender.

I’m struggling to understand what you mean- what is a “world normal”?

2 Likes

I apologize, I mean object space, not world space. though I supposed they can be interchangeable.

Take the following image for example.
image

Right side is world/object space normal map. We can bake these out in blender, we can also bake object space position textures in blender as well.

Here’s a look at a object/world space position:

Basically, I just want to know if I’m able to use a texture like this in a shader in leu of using the vertices positions to calculate lighting with an effect I have in mind.

1 Like

Are you sure? Because:

It dont. World space normal and object space normal are 2 different things.

2 Likes

The semantics aren’t really important to me.

The question I’m asking is if there’s a way to utilize a baked position texture map in blender, to affect how lighting is calculated. IE, can I bake vertex positions to a texture, load it into photoshop, apply some filters or distortions to it, throw it back into blender, and use that to affect the calculated lighting of my material.

1 Like

Yes. You can do all those things. Of course, the lighting calculations will require a bit more math, than just to bake position and normal vectors (and most of the time you don’t even need to bake them since they are part of each vertex).

1 Like

I want to bake them, so I can alter them on a per pixel basis in something like photoshop. I’m assuming this likely means writing my own lighting calculations, which i’m sure are even possible.

1 Like

Its not a “semantic” question at all and would directly affect the final results.

Everything related to “world” are just “Geometry” node in the shader. Transforming to object space can be done by “Vector transform” node.

I think you’re still missing the actual question I’m asking. I’m not trying to convert from object space to tangent space, or from object space to world space or vice versa.

I only want to know if I can bake the object’s position attributes to a texture, manipulate it by hand in a third party app like photoshop or substance, then utilize that altered version in blender to calculate some funky npr shading effects.

Just use the Geometry node, plug the Position (or the Normal) into the Surface socket in the Material Output, Bake emission, and save as EXR (Float(full)).

1 Like

For example, one of the possible uses would be texel (or obbject) space shading, as demonstrated in this godot 4.3 proof of concept, which I created:

This works by baking the position attribute to a low resolution texture then using that as input for a material in godot, assigning to an attribute called light_vertex, which is a duplicate of the vertex position, but only used for lighting calculations without affecting the position of any verts.

I know how to bake the position attributes, I’m referring specifically to putting that texture back into blender to use in a shader.

Yes, you can use a texture to store vector information and then use it as the coordinate system for anything else. You only need to have a very good image format (as EXR) to be able to store vectors.

1 Like

I have the exrs already, as demonstrated by my godot proof of concept. How can I, in a material, use a position exr texture to affect the lighting? Do you have an example of this in use?

Thats exactly the part where you need some math and brains to figure that out.

This is what I’m trying to get help with.

You’re basically trying to create a new Render Engine… It’s not easy, and depending what you want to achieve, it can become complicated very quickly.

1 Like

So without rewriting a complicated node group in blender, it is not possible to use a 32bit position texture to alter the built in lighting calculations used to shade a model?

It’s difficult to answer that… You cannot alter the lighting calculations… but you can alter parameters of your shader to produce results that may be considered unrealistic. For example by changing the normal of some closure, or affecting the position using displacements.

1 Like

Hmm, this makes the effect I hope to achieve, not possible within blender without rewriting the engine.