C4D OSL Camera Issue

Maxon Cinema 4D (Export script developed by abstrax, Integrated Plugin developed by aoktar)

Moderators: ChrisHekman, aoktar

FullHPetroL
Licensed Customer
Posts: 42
Joined: Mon Apr 27, 2015 10:00 am

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]
Attachments
2019-03-22_12-49-06.png
milanm
Licensed Customer
Posts: 261
Joined: Tue Apr 30, 2013 7:23 pm

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
Colorist / VFX artist / Motion Designer
macOS - Windows 7 - Cinema 4D R19.068 - GTX1070TI - GTX780
FullHPetroL
Licensed Customer
Posts: 42
Joined: Mon Apr 27, 2015 10:00 am

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?
milanm
Licensed Customer
Posts: 261
Joined: Tue Apr 30, 2013 7:23 pm

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
Colorist / VFX artist / Motion Designer
macOS - Windows 7 - Cinema 4D R19.068 - GTX1070TI - GTX780
User avatar
aoktar
Octane Plugin Developer
Posts: 16066
Joined: Tue Mar 23, 2010 8:28 pm
Location: Türkiye
Contact:

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.
Octane For Cinema 4D developer / 3d generalist

3930k / 16gb / 780ti + 1070/1080 / psu 1600w / numerous hw
FullHPetroL
Licensed Customer
Posts: 42
Joined: Mon Apr 27, 2015 10:00 am

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.
Attachments
OSL Camera Custom aperture.zip
(118.9 KiB) Downloaded 158 times
milanm
Licensed Customer
Posts: 261
Joined: Tue Apr 30, 2013 7:23 pm

@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
Colorist / VFX artist / Motion Designer
macOS - Windows 7 - Cinema 4D R19.068 - GTX1070TI - GTX780
User avatar
aoktar
Octane Plugin Developer
Posts: 16066
Joined: Tue Mar 23, 2010 8:28 pm
Location: Türkiye
Contact:

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.
Attachments
a1.jpg
Octane For Cinema 4D developer / 3d generalist

3930k / 16gb / 780ti + 1070/1080 / psu 1600w / numerous hw
User avatar
aoktar
Octane Plugin Developer
Posts: 16066
Joined: Tue Mar 23, 2010 8:28 pm
Location: Türkiye
Contact:

Here's fixed build
viewtopic.php?f=85&t=71065
Octane For Cinema 4D developer / 3d generalist

3930k / 16gb / 780ti + 1070/1080 / psu 1600w / numerous hw
FullHPetroL
Licensed Customer
Posts: 42
Joined: Mon Apr 27, 2015 10:00 am

aoktar wrote:Here's fixed build
viewtopic.php?f=85&t=71065
Please, verify it is working, for It doesn't work for me.
Attachments
OSL Camera Custom aperture 2.zip
(155.19 KiB) Downloaded 156 times
Post Reply

Return to “Maxon Cinema 4D”