Bake spotlight texture?

Is it possible to bake the result of a projected texture from a spotlight?

For example, in this demo, the spotlight projects a texture onto the model.

Can we “bake” this so the texture becomes a more permanent part of the model without the spotlight (remove the spotlight after baking)?

1 Like

I think this may be a solution for this challenge

1 Like

I’m using that for the <lume-texture-projector> element in Lume. But it’s basically the same thing right? I think what we need to do to “bake it” is dynamically create a UV map, then we can have two maps, color and UV, without the spotlight or the projector.

Maybe the question is, how would we generate the UV map? Hmmm.

vector3.project(projectionCamera)?


Demo: https://codepen.io/prisoner849/full/BaeBdGE

2 Likes

Can you put that in a live sample, perhaps on codepen?

Added the link to codepen, in my previous post.

TBH, I don’t know how correct this approach is :sweat_smile:

1 Like

The pen describes what was imagined when you posted…

This is a great approach for certain limited camera views but essentially you’d end up with repeated negative z camera space uv’s on opposite faces of meshes that the camera is looking at…

@trusktr you’d ideally want to reuse the uv’s that already exist on a geometry and somewhat “ray trace” on to that uv space, this way you could blend the baked light over a diffuse texture in shader, look into how maya and substance handle this, otherwise you’re looking at lightMaps on a secondary UV space similar to blenders typical approach to baking lighting…

@prisoner849 nice! Here’s the demo with a little animation to show it is “baked”:

(posting the URL on its own line makes it embed the demo here)

1 Like

Got a link?

Here’s ^^^ an overview of how the technical process works in maya, however this has no insight into the proprietary mechanics around how this is done…

Afaik, I think it’s known as PRT or “precomputed radiance transfer” there’s an old (abandoned?) repo I found that looks like it touches on this… GitHub - kevenv/prt: Precomputed Radiance Transfert (PRT)

1 Like