DCTL _tex2D - sampling arbitrary variables

Ask software engineering and SDK questions for developers working on Mac OS X, Windows or Linux.
  • Author
  • Message
Offline

Overtone85

  • Posts: 6
  • Joined: Mon Feb 27, 2023 10:52 am
  • Real Name: Riccardo Coccia

DCTL _tex2D - sampling arbitrary variables

PostThu Mar 09, 2023 9:43 am

Not sure if this is the right forum for asking.

I am experimenting with DCTL plugins and I am having a hard time finding information on all the available functions. The readme document in the Davinci folder doesn't explain the full specification from what I understand.

I am modifying someone else's code to my liking and I see that the _tex2D([textureVariable], [posX], [posY]) function only accepts the p_TexR, p_TexG, p_TexB variables, which to my understanding are global variables coming from the input image.

But is it possible to use the function to sample an arbitrary variable from inside the DCTL code? For example:

Code: Select all
__DEVICE__ float3 transform(int p_Width, int p_Height, int p_X, int p_Y, __TEXTURE__ p_TexR, __TEXTURE__ p_TexG, __TEXTURE__ p_TexB) {

    float redChannel = _tex2D(p_TexR, p_X, p_Y) ;
   
    float modifiedRedChannel = redChannel * 2.0f ;

    float sampleModifiedRedChannel = _tex2D( modifiedRedChannel , 1 , 1) ;
}


I know that the code above would error, but you get the idea of what i am after. If not _tex2D is there another function that can be used?

Thanks
Lumix DC-S1H
Atomos Ninja V+
Assimilate Play Pro
Davinci Resolve 18.1.2 Build 6
Macbook Pro M1 Max late 2021
Offline

Overtone85

  • Posts: 6
  • Joined: Mon Feb 27, 2023 10:52 am
  • Real Name: Riccardo Coccia

Re: DCTL _tex2D - sampling arbitrary variables

PostThu Mar 09, 2023 6:19 pm

Just to clarify...
The reason I am using _tex2D in this example is because I don't know what other functions are available.
I chose the top right pixel just for the sake of the example.
p_TexR and modifiedRedChannel are not the same. I would like to be able to sample the variable modifiedRedChannel at a specified pixel. The goal is sampling a color that is not the original input image, but rather something that has been processed in the DCTL code.

UPDATE:
I was told in another forum that this is possible using buffers. Is there any info about using buffers in DCTL that I can look into?

Cheers
Lumix DC-S1H
Atomos Ninja V+
Assimilate Play Pro
Davinci Resolve 18.1.2 Build 6
Macbook Pro M1 Max late 2021
Offline

Anthony Lunt

  • Posts: 10
  • Joined: Wed Feb 22, 2023 6:11 am
  • Location: United States
  • Real Name: Anthony Lunt

Re: DCTL _tex2D - sampling arbitrary variables

PostFri Mar 10, 2023 5:48 am

Overtone85 wrote:Not sure if this is the right forum for asking.

I am experimenting with DCTL plugins and I am having a hard time finding information on all the available functions. The readme document in the Davinci folder doesn't explain the full specification from what I understand.

I am modifying someone else's code to my liking and I see that the _tex2D([textureVariable], [posX], [posY]) function only accepts the p_TexR, p_TexG, p_TexB variables, which to my understanding are global variables coming from the input image.

But is it possible to use the function to sample an arbitrary variable from inside the DCTL code? For example:

Code: Select all
__DEVICE__ float3 transform(int p_Width, int p_Height, int p_X, int p_Y, __TEXTURE__ p_TexR, __TEXTURE__ p_TexG, __TEXTURE__ p_TexB) {

    float redChannel = _tex2D(p_TexR, p_X, p_Y) ;
   
    float modifiedRedChannel = redChannel * 2.0f ;

    float sampleModifiedRedChannel = _tex2D( modifiedRedChannel , 1 , 1) ;
}


I know that the code above would error, but you get the idea of what i am after. If not _tex2D is there another function that can be used?

Thanks

Thanks for sharing Great Information!
Offline

Sven H

  • Posts: 852
  • Joined: Mon May 24, 2021 9:11 am
  • Real Name: Sven Hegen

Re: DCTL _tex2D - sampling arbitrary variables

PostFri Mar 10, 2023 8:35 am

Overtone85 wrote:Just to clarify...
UPDATE:
I was told in another forum that this is possible using buffers. Is there any info about using buffers in DCTL that I can look into?

Cheers

I was Just about to say "no, it doesn't work". The I read your last sentence, so I'm jumping on board asking how to use buffers.

__TEXTURE__ is only useful when you are building spatial effects like blurs. For simpler stuff like Contrast and Color it's way easier to use normal devices and float values. p_R instead of p_TexR and so on
Offline

Overtone85

  • Posts: 6
  • Joined: Mon Feb 27, 2023 10:52 am
  • Real Name: Riccardo Coccia

Re: DCTL _tex2D - sampling arbitrary variables

PostFri Mar 10, 2023 11:55 am

Sven H wrote:
Overtone85 wrote:Just to clarify...
UPDATE:
I was told in another forum that this is possible using buffers. Is there any info about using buffers in DCTL that I can look into?

Cheers

I was Just about to say "no, it doesn't work". The I read your last sentence, so I'm jumping on board asking how to use buffers.

__TEXTURE__ is only useful when you are building spatial effects like blurs. For simpler stuff like Contrast and Color it's way easier to use normal devices and float values. p_R instead of p_TexR and so on


the goal is indeed to modify a blur function i found, so that it processes a color that has been modified inside the DCTL script, without having to do that modification in another node upstream.
Lumix DC-S1H
Atomos Ninja V+
Assimilate Play Pro
Davinci Resolve 18.1.2 Build 6
Macbook Pro M1 Max late 2021

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 9 guests