Author Topic: Is it possible to make an OSL shader that rotates a color map?  (Read 710 times)

2025-01-23, 09:05:32

batzlat

  • Active Users
  • **
  • Posts: 5
    • View Profile
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

2025-01-27, 17:01:41
Reply #1

maru

  • Corona Team
  • Active Users
  • ****
  • Posts: 13511
  • Marcin
    • View Profile
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?
Marcin Miodek | chaos-corona.com
3D Support Team Lead - Corona | contact us

2025-01-30, 09:10:37
Reply #2

batzlat

  • Active Users
  • **
  • Posts: 5
    • View Profile
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.

2025-01-30, 10:33:28
Reply #3

Aram Avetisyan

  • Corona Team
  • Active Users
  • ****
  • Posts: 877
    • View Profile
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.
Aram Avetisyan | chaos-corona.com
Chaos Corona QA Specialist | contact us

2025-01-30, 12:10:26
Reply #4

batzlat

  • Active Users
  • **
  • Posts: 5
    • View Profile
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.

2025-01-30, 12:35:41
Reply #5

batzlat

  • Active Users
  • **
  • Posts: 5
    • View Profile
To be more specific, I want to rotate those coordinates (see attached), or somehow UVW (if possible) to make the same outcome.

2025-01-30, 15:54:35
Reply #6

Jpjapers

  • Active Users
  • **
  • Posts: 1715
    • View Profile
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.

2025-01-31, 08:27:52
Reply #7

batzlat

  • Active Users
  • **
  • Posts: 5
    • View Profile
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.

2025-01-31, 08:59:50
Reply #8

Aram Avetisyan

  • Corona Team
  • Active Users
  • ****
  • Posts: 877
    • View Profile
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?
Aram Avetisyan | chaos-corona.com
Chaos Corona QA Specialist | contact us