View Issue Details

IDProjectCategoryView StatusLast Update
0001277FreeCADFeaturepublic2013-11-04 22:54
Reporterpkoning Assigned Toyorik  
PrioritynormalSeverityfeatureReproducibilityalways
Status closedResolutionfixed 
Product Version0.13 
Fixed in Version0.14 
Summary0001277: FeaturePython objects should be able to define how POVray output is generated
DescriptionRight now, exporting to POVray simply outputs every object separately, as a mesh. That's fine for simple designs. For complex designs, the resulting files get very large.
I'm doing modeling where I have a lot of instances of scripted objects (FeaturePython objects). The scripting basically does positioning (rotation etc.) -- there are only a few distinct shapes involved.
So what I need is to be able to have a FeaturePython class tell the raytracing export machinery what to write. In my case, I'd output a single POVray object definition for the basic shapes I have, and then generate just a few lines of code for each instance, which invokes that object and places it in the correct spot.
The same basic machinery also would allow animation to be done cleanly -- if I could express, say, a rotation angle in terms of the POVray "clock" variable, then the resulting output could be directly animated without manual editing.
TagsNo tags attached.
FreeCAD Information

Activities

pkoning

2013-10-17 14:08

reporter   ~0003764

One thing needed for this is a way to get POVray descriptions, or get the data needed to create them, for individual objects or shapes.
I did some digging and found that I can almost do this today. The current raytracing export writes lots of mesh models, which is a fine way to handle many shapes. And I can get parts of that triangle mesh data by using the "tesselate" shape method. But what's missing is the normals data, so for curved faces I don't have a way to generate what POVray calls "smooth triangles". I don't see an obvious way to get that information.
A nice way to do this sort of thing is to define a method that returns the current POVray model, as a #declare statement, for a given shape. I could then write a loop that walks over all the objects, generating custom output when the object's class has defined a method for that, or fall back to the stock output otherwise.

yorik

2013-10-25 20:36

administrator   ~0003808

Okay, what we would need here is a kind of empty rayfeature object, same as in the drawing module, where you can put your own output data.

I think the RaySegment object, which is the base class of both povray and luxrender objects, could be used for that, again, same as in the drawing module... Apparently it would only need a viewprovider, and be handled by both pov and lux projects. Then it would be up to the user to create those objects, and put in their Result property the custom pov data you want...

I'll see if I can do it.

yorik

2013-10-27 15:53

administrator   ~0003817

Done with commit 4d19a79
A RaySegment object can now be added to povray and luxrender projects, and it can hold user-defined povray or luxrender code. I updated the doc on http://www.freecadweb.org/wiki/index.php?title=Raytracing_Module#Creating_a_custom_render_object with explanations on how to use it.

Related Changesets

FreeCAD: master 4d19a79c

2013-10-27 14:32:47

Yorik van Havre

Details Diff
0001277: Allow to use RaySegment object in Raytracing projects Affected Issues
0001277
mod - src/Mod/Raytracing/App/LuxProject.cpp Diff File
mod - src/Mod/Raytracing/App/RayProject.cpp Diff File
mod - src/Mod/Raytracing/App/RaySegment.h Diff File

Issue History

Date Modified Username Field Change
2013-10-16 16:16 pkoning New Issue
2013-10-17 14:08 pkoning Note Added: 0003764
2013-10-25 20:36 yorik Note Added: 0003808
2013-10-25 20:36 yorik Status new => assigned
2013-10-25 20:36 yorik Assigned To => yorik
2013-10-27 15:53 yorik Note Added: 0003817
2013-10-27 15:53 yorik Status assigned => closed
2013-10-27 15:53 yorik Resolution open => fixed
2013-10-27 15:53 yorik Fixed in Version => 0.14
2013-11-04 22:54 yorik Changeset attached => FreeCAD Master master 4d19a79c