在FreeCAD中进行渲染

本文介绍如何在FreeCAD中使用RenderWorkbench结合LuxCoreRender进行3D模型渲染,包括组件安装、材质设置及渲染输出等关键步骤。

前言

3D建模软件通常都可以结合渲染器进行渲染出图,虽然对FreeCAD这种偏向生产应用的3D建模软件来说渲染其实没太大用处,不过有时候渲染下出个图,写文档做方案给非同行看还是不错的。

基础说明

目前版本为 0.19.4,这里将以此为基础进行说明。

FreeCAD中默认安装有Raytracing工作台,这个工作台提供渲染相关支持,实际的渲染工作需要调用外部渲染器进行。Raytracing工作台可以支持的渲染器有POV-Ray和LuxRender。 POV-Ray 已经很久没有实质性的更新了; LuxRender在1.6 版本后有比较大的变动,现在新的版本叫做 LuxCoreRender ,相比旧版本变动还是挺大的。

因为以上一些原因所以FreeCAD又有了一个正在开发的代替Raytracing的工作台Render。Render提供了对更多渲染器的支持,新增和优化了一些功能。

下面将以Render Workbench和LuxCoreRender为基础进行说明演示。

组件安装

LuxCoreRender

LuxCoreRender可以从下面地址获取,下载对应操作系统的独立版本就行:
LuxCoreRender官网:https://luxcorerender.org/
LuxCoreRender项目页面:https://github.com/LuxCoreRender/LuxCore/

下载完成后直接解压就行。

Render Workbench

Render Workbench最简单的安装方法就是通过Addon Manager:
在这里插入图片描述
当然网络不好的情况下通常上面方式没法安装上,就得靠手动方式进行安装。

手动安装的话首先去下面地址下载,选择 Code > Download ZIP
FreeCAD Render Workbench 项目地址:https://github.com/FreeCAD/FreeCAD-render
在这里插入图片描述
在FreeCAD首选项中选择外部工作台和宏目录:
在这里插入图片描述
在外部工作台和宏目录中新建 Mod 文件夹,在其中再建立 Render 文件夹,然后将前面下载的压缩包中文件夹中子内容全部复制到 Render 文件夹中:
在这里插入图片描述
才重新启动FreeCAD后就可以在工作台选择器中看到Render工作台了,选则切换到它:
在这里插入图片描述
再次打开首选项就可以看到对Render的设置了,在这里设置前面下载解压的LuxCoreRender应用程序路径:
在这里插入图片描述

渲染输出

需要用到的组件安装配置完成后就可以进行渲染了,渲染前需要对模型设置材质和颜色(也可以在后面通过Render工作台来设置材质和颜色):
在这里插入图片描述

对模型进行渲染输出图像操作很简单:选择渲染器和模板文件 > 将模型添加到渲染工程中 > 选中渲染工程进行渲染
在这里插入图片描述
LuxCoreRender开始工作后就会持续进行渲染,效果会随着时间越来越好,如果你觉得满意了就可以关闭LuxCoreRender窗口,它会输出最后的画面。
在渲染过程中可以点击拖动模型位置。如果要调整模型大小或是角度的话可以停止当前渲染,在FreeCAD中调整好模型在3D视图中的大小和角度,然后重新进行渲染。

上面的动图中因为压缩渲染窗口中色彩有断层,下面是实际渲染出的效果:
在这里插入图片描述

后记

FreeCAD中直接渲染通常只适合简单用用,如果需要具有更加丰富的选项调整、获得更加华丽的效果,那还是将模型导出到其它专业的用于渲染的软件中进行处理比较合适。FreeCAD的WiKi中就建议使用另一款开源的3D软件 Blender 进行渲染。

Module developer’s guide to FreeCAD source code by Qingfeng Xia http://www.iesensor.com • 2015-09-18 version 0.1 for FreeCAD version 0.16-dev • 2016-09-18 version 0.2 for FreeCAD version 0.17-dev License of this book This ebook is licensed the same as FreeCAD document license CC-BY 3.0 http://creativecommons.org/licenses/by/3.0/Contents 1 FreeCAD overview and architecture 7 1.1 Introduction to FreeCAD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1.2 Key features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1.3 Software architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1.3.1 Key software libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1.3.2 Mixed python and c++ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.3.3 GPL code will not be included into installer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.4 How 3D model are renderred . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.4.1 Selection of 3D visualization libarary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.4.2 Discussion of 3D rendering library selection on FreeCAD Forum . . . . . . . . . . . . . . . . . . . . . 8 1.5 Roadmap of FreeCAD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 1.5.1 Keep updated with main components: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 1.5.2 C++11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 1.5.3 Pyside 2 project for Qt 5.x . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2 Organisation of FreeCAD source code 11 2.1 Build system for FreeCAD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 2.1.1 Analysis of src/cMake/SMesh.cMake . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 2.2 List of files and folders in FreeCAD source folder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 2.3 List of modules in FreeCAD Mod folder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.4 Learning path . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 2.5 Learning OpenInventor/Coin3D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 2.5.1 OpenInventor in FreeCAD’s ViewProvider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 2.5.2 Important classes in OpenInventor/Coin3D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 2.5.3 Window System integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 2.5.4 Pivy: Coin3D ’s Python wrapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 3 Base, App and Main module 19 3.1 List of header files in Base folder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 3.1.1 Frequently included headers files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 3.1.2 Correct way of using Sequencer in try-catch block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 3.1.3 String enconding utf8 and conversion into wchar_t QString . . . . . . . . . . . . . . . . . . . . . . . . 22 3.2 Type, BaseClass, PyObjectBase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 3.2.1 Type system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 3.2.2 src/Base/BaseClass.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 3.2.3 src/Base/PyObjectBase.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 3.2.4 src/Base/Persistence.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 3.2.5 GeoFeature: Base class of all geometric document objects . . . . . . . . . . . . . . . . . . . . . . . . . 26 3.3 Unit scheme for physial quantity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 3.3.1 src/Base/Unit.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 3.3.2 src/Base/Quantity.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 3.4 List of header files in App folder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 3.5 Property framewrok . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 3.5.1 Naming of property and PropertyEditor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 3.5.2 src/App/PropertyStandard.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 3.5.3 PropertyEnumeration, see src/App/Enumeration.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 3.5.4 Geometry related property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 3.5.5 File related property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 1
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Naisu Xu

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值