Crash when using C4D shader in Redshift
-
Hi,
I've written several shaders which I also use in Redshift using the C4D Shader material. I get a consistent crash in the following circumstances:- the renderer is Redshift and the material is the C4D Shader mat
- the shader contains a gradient
- the texture parameters in the C4D Shader Node are set high (e.g. 512 x 512)
- the user edits the gradient by scrubbing one of the gradient knots quickly to left or right
The crash occurs in customgui_gradient.cpp at line 59, which is:
maxon::Result<maxon::GradientRenderData> Gradient::PrepareRenderData(const InitRenderStruct &irs) const { GradientCallRC(maxon::UnexpectedError(MAXON_SOURCE_LOCATION, "Gradient::PrepareRenderData() not found."_s), PrepareRenderData)(irs); }
It happens in all the shaders I've written which use a gradient. It looks as if scrubbing the knot forces Redshift to repeatedly bake the shader and doesn't like it for some reason, but that is just a guess.
To demonstrate this, I've written a very basic shader plugin - it just draws a red-blue gradient over the surface. The attached file has the source and a debug version of the shader built with the R2024 SDK. To see it, load the included example file, then scrub one of the knots in the gradient, increasing the texture parameter size until it crashes.
I should also mention that this does not happen in the standard renderer.
Cheers,
Steve
RSC4DShader.zip -
F ferdinand moved this topic from Cinema 4D SDK on
-
Hey @spedler,
Thank you for reaching out to us. This should not crash. But for me your plugin is not even loading/registering (I just tried the binary in your zip). I was trying to load the binary with 2024.4.0 (Build 2024_4_14d2cb99a70f_1236864028) Win. For which version of the SDK did you build? Did you use an older SDK such as 2024.5.1 ?
And I then saw this:
Please never do something like this, invent plugins IDs and then distribute them, and if you invent a plugin ID for private testing purposes, it is better to invent one after 2 000 000 , because everything below 100 000 is really dangerous, as there are interal types, the current public plugin ID counter is at roughly 1 100 000, and at the end of the
Int32
adress space is usded for dynamic command/plugin IDs, i.e., when you give your plugin the ID (INT32_MAX - 1000
- or-3455
, -25, ...), there is a pretty good chance that this will cause issuses or even crashes.I have moved this into bugs for now, I will try to rebuild your plugin and then submit a crash report. Because when not your a bit spicey plugin ID is the culprit, this is probably not an SDK issue, but rather something deeper, given your problem description, and your code (which looks fine to me at first glance).
Cheers,
Ferdinandedit: okay, I installed 2024.5.1, and there your plugin loads but I cannot get it to crash. I also tried scrubbing while the material is assigned to an object (so that the viewport preview for the material must be built).
When you submit a crash report, please tell us so here with the date and time of submission, so that we can search for it.
-
Hi @ferdinand
Firstly, many thanks for looking at this. The plugin ID is a silly mistake on my part (I didn't realise that VS had auto-completed with the wrong ID). It should be ID_RSC4DSHADER (not IDS...) in the register function. If you look in rsc4dshader.h, you'll see it correctly identified with a valid plugin ID there. I was in a bit of a hurry building this and didn't realise what had happened. I'm surprised it ran at all TBH!
The SDK version was 2024.5.1 (Build 2024_5_ac4bc44383e4_1378804312). Isn't this a newer SDK than 2024.4.0, not an older one?
I can get the crash in 2024 but I've tried now in 2025.2.1 and it doesn't crash, so possibly whatever it is was fixed. I've also tried several other of my shader plugins in 2024 and they all exhibit the same issue, crash in 2024 but not in 2025.
Cheers,
Steve -
@spedler said in Crash when using C4D shader in Redshift:
The SDK version was 2024.5.1 (Build 2024_5_ac4bc44383e4_1378804312). Isn't this a newer SDK than 2024.4.0, not an older one?
Yes, it is. I formulated it a bit misleading in the video.
When you can reproduce the crash in 2024.5.1 (the version I used), I/we would still be interested in a crash report if you have one
Cheers,
Ferdinand -
Hi @ferdinand
Thanks, I’ll submit a crash report as soon as I can. The power keeps going on and off here, when it’s restored I’ll send one in.
Steve
-
Yeah, no hurry, and thanks for caring
-
Tried to send the crash report on 6/6/25 at 22:08 but I got a message saying there was a problem sending it. The message also says to send it by email so I've sent it to sdk_support(at)maxon(dot)net.
Steve