On 08/01/2015 at 05:25, xxxxxxxx wrote:
Cinema 4D Version: 16
Platform: Mac ; Mac OSX ;
Language(s) : C++ ; PYTHON ;
Hello. This is a C++ or Python issue (whichever works), hopefully I'm posting in the right place.
I've hit a bit of a wall with a side project I'm working on and I could do with some advice or at least a pointer in the right direction.
I've created the base for a custom particle/tracer system. The editor uses BaseDraw (python at the moment) to draw everything in the viewport which is great, I can even render in openGL hardware mode.
Here's a screen cap:
The challenge is to be able to render the tracers as a separate pass, I've had a couple of ideas on how to do this but everything seems to fall short in one way or another.
What I need, is to render the lines after the intersections on any geometry have been calculated. The viewport render is nearly there but just I get all of the geometry shading which I don't want.
An idea was to convert the lines to screen space and then draw them in a videopost plugin. I could do some nice things like blending modes with this but unfortunately would lose the geometry intersections. I'm quite happy to render single pixel width lines, as long as I have control over colour.
Is there a way to isolate some of a BaseDraw pass?
Is there any part of the c++ or python documentation I should be looking at?
Does anyone have any examples they could direct me to which could help me achieve what I'm trying to do?
I found this post really useful but I think I need a bit more focusing in the right direction.
On 08/01/2015 at 05:34, xxxxxxxx wrote:
why not render these lines as hairs? and they will be traced automatically by the renderer "may be with hair generator, generate circle" , this should work as you wanted and it will include the lines in the GI too!!
On 08/01/2015 at 07:14, xxxxxxxx wrote:
Fantastic. This looks like a great place to start. I've just noticed the hair generator c++ example too.
Great suggestion - I'm still open to any others that people may have too.
On 08/01/2015 at 07:28, xxxxxxxx wrote:
a BaseDraw is not used to draw something in the viewport; a BaseDraw is a viewport window, so there is no "BaseDraw pass".
to create render plugins you have to create a VideoPostData plugin. This kind of plugin allows you to create post effects that can also render into their own mulitpasses. In the C++ SDK you find several VideoPostData examples.
To create a custom mutlipass layer you have to create this layer in the AllocateBuffers() method using AllocateBufferFX(). You can later access that buffer using GetBuffer().
To covert coordinates into screen space you can access the render BaseDraw from the document using GetRenderBaseDraw() (take a look at the LookAtCamera example). Then you can use various methods to convert world space coordiantes to screen space coordinates.
On 08/01/2015 at 07:47, xxxxxxxx wrote:
Thanks Sebastian, that's really useful.
I have managed to make a couple of really basic video post plugins and can get the main buffers (RGBA, ALPHA) and modify them. That part of the project, I've already started building, the AllocateBufferFX() sounds like a missing part of that puzzle I was looking for.
It's the drawing my array of points taking into account geometry intersections which has had the biggest question mark for me.
Thanks for clearing up the BaseDraw confusion.