Page 1 of 2

C4D OSL Camera Issue

Posted: Fri Mar 22, 2019 6:09 am
by FullHPetroL
Can anyone explain (and, preferably, attach a working c4d file) how to work with OSL Camera script "texture aperture cam"?
No matter what I do, I get the same black screen.
I follow the instructions, but it doesn't work for me [picture_of_a_sad_cat.jpg]

Re: C4D OSL Camera Issue

Posted: Fri Mar 22, 2019 6:54 am
by milanm
You should use OSL Delayed UV projection in the ImageTexture node (I guess you already used that but I need to make sure). That's the only requirement.

BUT unfortunately it will not work because there is a bug in the C4D Octane plugin for color inputs in the camera shader. Because of that bug ImageTexture node will be ignored.

Cheers
Milan

Re: C4D OSL Camera Issue

Posted: Fri Mar 22, 2019 9:30 am
by FullHPetroL
milanm wrote:You should use OSL Delayed UV projection in the ImageTexture node (I guess you already used that but I need to make sure). That's the only requirement.

BUT unfortunately it will not work because there is a bug in the C4D Octane plugin for color inputs in the camera shader. Because of that bug ImageTexture node will be ignored.

Cheers
Milan
so, for now it appears to be useless, right?

Re: C4D OSL Camera Issue

Posted: Fri Mar 22, 2019 9:59 am
by milanm
FullHPetroL wrote:
milanm wrote:You should use OSL Delayed UV projection in the ImageTexture node (I guess you already used that but I need to make sure). That's the only requirement.

BUT unfortunately it will not work because there is a bug in the C4D Octane plugin for color inputs in the camera shader. Because of that bug ImageTexture node will be ignored.

Cheers
Milan
so, for now it appears to be useless, right?
If you use it as it is, then yes, that's true.

The code can be easily changed, however, to use builtin OSL texture() function instead of _evaluateDelayed(). That could work, but then you're facing another problem because the file paths will have to be absolute and if you save project with assets your aperture texture will not be included. Also you will not be able to take advantage of texture compression and other settings we have in the ImageTexture node.

In that case you would have to change the apertureTexture input to a string value (file path) instead of color.

Cheers
Milan

Re: C4D OSL Camera Issue

Posted: Fri Mar 22, 2019 10:14 am
by aoktar
milanm wrote:You should use OSL Delayed UV projection in the ImageTexture node (I guess you already used that but I need to make sure). That's the only requirement.

BUT unfortunately it will not work because there is a bug in the C4D Octane plugin for color inputs in the camera shader. Because of that bug ImageTexture node will be ignored.

Cheers
Milan
Don't know what are you saying here as bug, would be great to point me that. BTW parameters are not magically appear in plugins. It has to implement for every types and cases. It's a complex part in plugin. Not a bug if I missed some cases.

Re: C4D OSL Camera Issue

Posted: Fri Mar 22, 2019 10:28 am
by FullHPetroL
aoktar wrote:
milanm wrote:You should use OSL Delayed UV projection in the ImageTexture node (I guess you already used that but I need to make sure). That's the only requirement.

BUT unfortunately it will not work because there is a bug in the C4D Octane plugin for color inputs in the camera shader. Because of that bug ImageTexture node will be ignored.

Cheers
Milan
Don't know what are you saying here as bug, would be great to point me that. BTW parameters are not magically appear in plugins. It has to implement for every types and cases. It's a complex part in plugin. Not a bug if I missed some cases.
Aoktar, I thought I did smth wrong and couldn't get the result. And as the custom OSL script for camera was available, I concluded it had to work.
So, I would like to point that this issue exists. Files are attached.

Re: C4D OSL Camera Issue

Posted: Fri Mar 22, 2019 1:08 pm
by milanm
@Ahmet

There is nothing to miss, OSL documentation is very clear about what inputs can be used. And there is not that many of them. :roll:

Color input in the camera shader doesn't work. You can see that the RGBSpectrum node is connected but it's missing in Octane.
CameraShader color input.png
This camera will not render black if any non black color is connected on the color input:

Code: Select all

shader OslCamera(

		 // Here is the color input
		 // In order for this camera to work you need to connect
		 // any color input here, RGBSpectrum, ImageTexture, FloatTexture... anything.
		 color ColorInput = 0,       

	   output point  pos  = P,
	   output vector dir  = 0,
	   output float  tMax = 1.0/0.0)
{
		float pa;
		int res[2];
		getattribute("camera:pixelaspect", pa);
		getattribute("camera:resolution", res);
		float aspect = pa * res[1] / res[0];
		vector right = cross(I, N);
		
		if (ColorInput != 0)
			dir = I + right * (u - .5) + N * (v - .5) * aspect;
		else
			dir = 0;
}
As you can see it works in Standalone if we add any other color than black:
Works fine in OctaneRender Standalone.png
In Cinema 4D we get this:
Black.png
Regards
Milan

Re: C4D OSL Camera Issue

Posted: Fri Mar 22, 2019 5:05 pm
by aoktar
I've tested it. It's a different issue than you estimated. Due to a missing parameter in my osl compiler and iterator function. I'm fixing it.

Re: C4D OSL Camera Issue

Posted: Sun Mar 24, 2019 6:28 pm
by aoktar
Here's fixed build
viewtopic.php?f=85&t=71065

Re: C4D OSL Camera Issue

Posted: Mon Mar 25, 2019 1:40 am
by FullHPetroL
aoktar wrote:Here's fixed build
viewtopic.php?f=85&t=71065
Please, verify it is working, for It doesn't work for me.