Cycles for Lightwave

I have this project too for porting to Lightwave a plugin Cycles renderer, my question is how to retrieve mesh to convert to Lightwave and to show rendering to windows as realtime ? How to start to porting to Lightwave as plugin ? I was inspired for Cycles for Cinema 4D, so i say how this developer have porting to Cinema 4D ?

Can you help me to see more clear in coding and architecture ?

Many thanks.

1 Like

@brecht : Hi, ok i’m working hard on that I begin to understand little by little to program my plugin Cycles for Lightwave. My question is how do i manage the cpu, gpu and opencl then render the rendering and transfer the color pixels to the Lightwave as being plugin ?

You might try reaching out to the developers for LuxCore or Appleseed, too- I’ve seen them on these forums answering these kinds of questions.

Of course but I specifically ask the cycles to unlock me in programming, if I ask elsewhere I think it’s a waste of time because it’s different the engine rendering.

@threedslider, I’m afraid your questions are too broad to give a good answer. We don’t currently have good documentation on how to integrate Cycles, best is to look at for example the Blender integration, the Cycles standalone application or something like GafferCycles.

If you have more specific questions we can try answering them, but a step by step guide on how to integrate Cycles is too much work.

Oh, right! I was thinking of the Blender rendering API, sorry about that. But they might still be of some help since they’ve integrated their rendering engines with other apps besides Blender. The Gaffer project that Brecht mentioned, for example also uses Appleseed. I’d be willing to bet that they’ve faced some of the same challenges.

@threedslider you may also want to peruse the code for the Cycles version of Rhinoceros 3D. Relevant repositories are RhinoCycles and CCSycles.

In the end it all boils down to:

  • ensure you have the Cycles code available to you as a library (shared or static, doesn’t matter).
  • use your host application API to get the geometry, lights, camera, materials
  • convert the host application data to what Cycles wants
  • set up a Cycles session (session parameters, buffer parameters)
  • register callbacks for handling results from render tiles
  • create a Cycles scene
  • pump in all data, tagging while doing so
  • kick of the session

You’ll be able to see this process easiest in the Cycles stand-alone app. There you’ll find code that converts from an XML representation into what Cycles wants.

3 Likes

@brecht : Ok i will see for Blender integration, Cycles standalone and GafferCycles too. Many thanks.

@Josephbburg Yes i am looking to integrate in Lightwave as plugin.

@jesterKing Great ! Thank you for your tips that i am looking for ! Cycles available with library -> it is done, use my host application API -> it is working so it is wip too from now, convert the host application data to Cycles -> i am working on that, set up a Cycles session -> yes i am looking to blender integration pointed by brecht, register callbacks for handling results from render tiles -> can you explain to me what does mean this ?… Thes rest they are ok for working to my project.

@threedslider when you say they are working for your project, what exactly do you mean? You already manage to start a render and get results out into Lightwave?

@jesterKing I mean it is not yet to get results into Lightwave so it is working as wip and heavily in dev.

@threedslider

Using the code for the standalone application look at the session_init() in cycles_standalone.cpp. You’ll see two callbacks being set.

In general reading through this file and stepping through its workings in a debugger is a really good way to get a grasp on how to set up a render session with Cycles, and what you can do to get it to draw results to a screen. And if you don’t want to just display you can set callbacks for write_render_tile_cb and update_render_tile_cb of ccl::Session.

Anyway, compiling the stand-alone app and stepping through it with a debugger attached will give you already a lot of insight.

@jesterKing Thank you for your info it is very useful. Can i may ask you for about volume shader? Since volume shader supports to smoke and fire simulation and it is inside to blender from source code, is it possible to extract and integrated into to Lightwave ? Is it not a problem of GPL, because it can sell too, right ?

Not sure about volume shaders really, since I haven’t exposed volume nodes to Rhino. I’m guessing that the simulations are transferred via point density textures, so you’ll need to just ensure you are able to create those.

Ok you mean I need to create my own smoke and fire to simulate and transfert via point density texture ?

Well, you use whatever LightWave offers for smoke and fire simulation and translate that to something Cycles understands. But I’d first concentrate on getting a first integration working with mesh geometry, textures, shaders (materials and environments) lights and camera.

From there support whatever LightWave has to offer and you can find a corresponding feature in Cycles in: particle systems, hair, etc.

Start with the simplest possible scene, say a box with a simple material, one light and a camera.

Lightwave does for smoke and fire simulation with OpenVDB and i am not sure if i can get this… However i can get particle system, hair etc… and translate to Cycles.

All right as you say i need to start the simplest with scene :slight_smile: