Chaos Corona Forum

Chaos Corona for 3ds Max => [Max] I need help! => Topic started by: batzlat on 2025-01-23, 09:05:32

Title: Is it possible to make an OSL shader that rotates a color map?
Post by: batzlat on 2025-01-23, 09:05:32
I am trying to manipulate a color map as an input in my OSL shader, but I am failing to make any rotation. Is it even possible to do that? I know there is a way for a bitmap (as string input), but I am not sure I can manipulate for color map input.

I created a shader that splits my plane to sectors by using 5 different coordinates(dynamically) and I want to manipulate procedurally by rotation each sector independently but I failed to do that. WIP Here is the code: https://pastecode.io/s/tksrqnbv
Title: Re: Is it possible to make an OSL shader that rotates a color map?
Post by: maru on 2025-01-27, 17:01:41
Sorry for the lack of replies here, but I think the topic is too hard to understand for those who are unfamiliar with what exactly you are doing. What exactly do you mean by "manipulating a color map"? Do you mean rotating a solid color? Why do you need to do that?
Title: Re: Is it possible to make an OSL shader that rotates a color map?
Post by: batzlat on 2025-01-30, 09:10:37
Sorry for the lack of details. I am trying to manipulate (yes, rotate) the PhoenixFDOceanTex map, which is used as a color map input. For now, I am using pre-rotated maps in different sectors I created, with the goal of making the waves move toward the helpers I use. However, my struggle is to use a single map that I can rotate dynamically depending on the sector it is used in.
Title: Re: Is it possible to make an OSL shader that rotates a color map?
Post by: Aram Avetisyan on 2025-01-30, 10:33:28
Hi,

I believe wire parameters is the thing you are looking for.
It is still not fully clear to me, but a triplanar map, which can rotate the texture based on a node, should work with OSL too. It may be worth a try.
Title: Re: Is it possible to make an OSL shader that rotates a color map?
Post by: batzlat on 2025-01-30, 12:10:26
I have attached 2 images to try make it clearer. Shader-Look is a grab viewport of the Plane with all the helpers, which are Wired to the controllers ( position X-Y-Z) and they determine the sectors of the separated plane's material. In that example I have made 16 sectors ( 16 helpers and 16 different (PhoenixFDOceanTex) maps. The maps are rotated manually by me. My intention is to use a single PhoenixFDOceanTex map and manipulate the rotation in the shader (if it's even possible), according to the sector it is used in.
Title: Re: Is it possible to make an OSL shader that rotates a color map?
Post by: batzlat on 2025-01-30, 12:35:41
To be more specific, I want to rotate those coordinates (see attached), or somehow UVW (if possible) to make the same outcome.
Title: Re: Is it possible to make an OSL shader that rotates a color map?
Post by: Jpjapers on 2025-01-30, 15:54:35
I think as Aram mentioned, you want wire parameters. You can connect an attribute of one object to another. For example you could manually set the waves to face the helper direction, then connect them together using wire parameters, retaining their orientation. Then when the helper rotates the map should also rotate.
Title: Re: Is it possible to make an OSL shader that rotates a color map?
Post by: batzlat on 2025-01-31, 08:27:52
Yes, but I still have to use 16 maps if I want to use 16 helpers. My initial idea is to use only 1 map and make the rotation procedural in the Shader, because I want to use that single map in 16 different sectors independently with different rotation.
Title: Re: Is it possible to make an OSL shader that rotates a color map?
Post by: Aram Avetisyan on 2025-01-31, 08:59:50
Yes, but I still have to use 16 maps if I want to use 16 helpers. My initial idea is to use only 1 map and make the rotation procedural in the Shader, because I want to use that single map in 16 different sectors independently with different rotation.

What about a multimap node, e.g. CoronaMultiMap?