Triplanar mapping / stochastic texturing

Discussion related to the Engine functionality, implementations and API.
User avatar
Dade
Developer
Posts: 3571
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Triplanar mapping / stochastic texturing

Post by Dade » Thu Jan 09, 2020 11:28 am

Dade wrote:
Thu Jan 09, 2020 10:41 am
patrickawalz wrote:
Thu Jan 09, 2020 12:22 am
The author of the technique byob shared is the same developer who wrote the tangent space normal mapping standard we use in lux. He has actually posted a new method that is state of the art. It also allows mixing of bump and normal maps, and to my knowledge doesn't require uvs.

He also provides source code.

https://mmikkelsen3d.blogspot.com/p/3d- ... s.html?m=1
However this looks like a totally new framework and it would require to change all bump map related code including all textures and materials. It is a lot of work.

I have written an specific implementation only for the triplanar texture of this new framework and it seems to work:

bump.jpg

However, because it is based on a different framework, it can not be mixed with other nodes so the setup must be something basic like the triplanar texture node must be plugged directly in Material socket. For instance, you can not use a scale texture node to scale the bump map intensity but I have to add to triplanar node an explicit parameter.

But first of all, LaciLaci can you post a test scene with seams so I can check if it really solves the problem ?

I can than expose this as an option so you have the freedom to choose if to have UVs or to use the automatic bump map support (with some limitation).
Support LuxCoreRender project with salts and bounties

juangea
Donor
Posts: 40
Joined: Thu Jan 02, 2020 6:23 pm

Re: Triplanar mapping / stochastic texturing

Post by juangea » Thu Jan 09, 2020 12:04 pm

We could have a TriPlanar bump node to be used in the bump slot, with the scale option in there, that could simplify understanding from users :)

User avatar
lacilaci
Donor
Posts: 1788
Joined: Fri May 04, 2018 5:16 am

Re: Triplanar mapping / stochastic texturing

Post by lacilaci » Thu Jan 09, 2020 12:04 pm

Dade wrote:
Thu Jan 09, 2020 11:28 am

But first of all, LaciLaci can you post a test scene with seams so I can check if it really solves the problem ?
Yes, check this seam
seam.jpg

in this scene
triplanar.rar
(2.59 MiB) Downloaded 2 times
Dade wrote:
Thu Jan 09, 2020 11:28 am
I can than expose this as an option so you have the freedom to choose if to have UVs or to use the automatic bump map support (with some limitation).
Yes please, the way I would imagine it is in blendluxcore there would be info (just like no uv warning) that triplanar is using autobump-whatever is the proper term. and a tooltip would explain it's limitations. When UV's are present then the warning isn't displayed and everything works.

HOWEVER!: this doesn't solve a problematic UV setup. For example if I start modeling from newly created cube, that has UV's in blender and start building walls from it, then Luxcore has UV's but they're all mangled up and cause trouble for shading. If this is the way it's gonna be handled, we need a good way to let user know what's the issue.

Can you identify problematic UV's? Cause I'm not sure when luxcore shading breaks for bump, is it overlapping uv's? Is it unmapped areas? Can luxcore find and autocorrect such malformed objects before render?

User avatar
lacilaci
Donor
Posts: 1788
Joined: Fri May 04, 2018 5:16 am

Re: Triplanar mapping / stochastic texturing

Post by lacilaci » Thu Jan 09, 2020 12:14 pm

While this all is kinda sub-optimal and half optimized solution.
I'd even sacrifice triplanar for the luxcore bump mapping. It's the first thing I notice when going from cycles to luxcore. So even in worst case scenario I'd rather educate user in manual or docs than lower bump mapping quality.

Anyways, Let's say your current solution works in my case (very strong bump mapping on unmapped object) how would stochastic projection work? Or would the stochastic projection work between seams and just blend? Same issue?

User avatar
Dade
Developer
Posts: 3571
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Triplanar mapping / stochastic texturing

Post by Dade » Thu Jan 09, 2020 1:07 pm

This is the original rendering:

orig.jpg

And this with the new "UV-less" method:

new.jpg

The bump scale is not exactly the same so the "UV-less" method looks a bit stronger (i.e. it would need to lower the scale). It seems to successful solve the seams problem. Does it looks ok ?
Support LuxCoreRender project with salts and bounties

User avatar
Dade
Developer
Posts: 3571
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Triplanar mapping / stochastic texturing

Post by Dade » Thu Jan 09, 2020 1:10 pm

lacilaci wrote:
Thu Jan 09, 2020 12:04 pm
HOWEVER!: this doesn't solve a problematic UV setup. For example if I start modeling from newly created cube, that has UV's in blender and start building walls from it, then Luxcore has UV's but they're all mangled up and cause trouble for shading. If this is the way it's gonna be handled, we need a good way to let user know what's the issue.
No, no, I'm not thinking to some automatic mode, I was thinking to an explicit user decision, a flag for:

- Bump map "UV" mode, like now, you need mesh UVs;

- Bump map "UV-less" mode, new one, it works without mesh UVs but has some restriction on the node setup;
Support LuxCoreRender project with salts and bounties

User avatar
lacilaci
Donor
Posts: 1788
Joined: Fri May 04, 2018 5:16 am

Re: Triplanar mapping / stochastic texturing

Post by lacilaci » Thu Jan 09, 2020 1:26 pm

Dade wrote:
Thu Jan 09, 2020 1:10 pm
lacilaci wrote:
Thu Jan 09, 2020 12:04 pm
HOWEVER!: this doesn't solve a problematic UV setup. For example if I start modeling from newly created cube, that has UV's in blender and start building walls from it, then Luxcore has UV's but they're all mangled up and cause trouble for shading. If this is the way it's gonna be handled, we need a good way to let user know what's the issue.
No, no, I'm not thinking to some automatic mode, I was thinking to an explicit user decision, a flag for:

- Bump map "UV" mode, like now, you need mesh UVs;

- Bump map "UV-less" mode, new one, it works without mesh UVs but has some restriction on the node setup;
Oh, ok. So a material node/triplanar node, could have a setting for "has proper UV mapping" or "has no uv mapping"...
I still do have to wonder if this applies for stochastic projection. Cause to me it seems this multiplies the problem.

What if I have a plane that is huge and it has no uv map. but still needs triplanar and randomized tiling? I understand that for every other purpose a triplanar is good enough but what will bump mapping look like? Will there be a seam between every stochastic texture sample or what? I can imagine that with proper UV seam/mapping this is a non-issue but with random objects/imported objects/malformed uvs' objects.. this can be a problem

User avatar
lacilaci
Donor
Posts: 1788
Joined: Fri May 04, 2018 5:16 am

Re: Triplanar mapping / stochastic texturing

Post by lacilaci » Thu Jan 09, 2020 1:29 pm

you know, I'm kinda expanding the problem to another feature (stochastic/random tiling) but I think one is built on another and data from those will be important for geopatern, right? Duplicating mesh over vertices using UV's?

User avatar
Dade
Developer
Posts: 3571
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Triplanar mapping / stochastic texturing

Post by Dade » Thu Jan 09, 2020 2:09 pm

lacilaci wrote:
Thu Jan 09, 2020 1:29 pm
you know, I'm kinda expanding the problem to another feature (stochastic/random tiling) but I think one is built on another and data from those will be important for geopatern, right? Duplicating mesh over vertices using UV's?
There should be no conflict between stochastic mapping and UV-less triplanar texture because they work in 2 different domains: stochastic/random tiling will be a new form of 2D UV mapping so it will used in the image map node to introduce randomness in tiles while UV-less is an option of triplanar texture node (a totally different node).
Support LuxCoreRender project with salts and bounties

User avatar
lacilaci
Donor
Posts: 1788
Joined: Fri May 04, 2018 5:16 am

Re: Triplanar mapping / stochastic texturing

Post by lacilaci » Thu Jan 09, 2020 2:16 pm

Dade wrote:
Thu Jan 09, 2020 2:09 pm
lacilaci wrote:
Thu Jan 09, 2020 1:29 pm
you know, I'm kinda expanding the problem to another feature (stochastic/random tiling) but I think one is built on another and data from those will be important for geopatern, right? Duplicating mesh over vertices using UV's?
There should be no conflict between stochastic mapping and UV-less triplanar texture because they work in 2 different domains: stochastic/random tiling will be a new form of 2D UV mapping so it will used in the image map node to introduce randomness in tiles while UV-less is an option of triplanar texture node (a totally different node).

This only makes sense thought for the bump mapping problem, seam. How can you make sure a randomized texture won't end up at projection seam and then another one will be sampled from different projection creating a seam?

Post Reply