Raytracing Workbench/pt-br: Difference between revisions

From FreeCAD Documentation
(Updating to match new version of source page)
(Updating to match new version of source page)
 
(59 intermediate revisions by 6 users not shown)
Line 1: Line 1:
<languages/>
The Raytracing module is used to generate photorealistic images of your models by rendering them with an external renderer. The Raytracing workbench works with [[Raytracing Module#Templates|templates]], the same way as the [[Drawing Module|Drawing workbench]], by allowing you to create a Raytracing project in which you add views of your objects. The project can then be exported to a ready-to-render file, or be rendered directly.

<div class="mw-translate-fuzzy">
{{Docnav
|[[Points_Workbench/pt-br|Bancadas de trabalho Points]]
|[[Reverse_Engineering_Workbench/pt-br|Bancadas de trabalho Reverse Engineering]]
|IconL=Workbench_Points.svg
|IconR=Workbench_Reverse_Engineering.svg
}}
</div>

{{VeryImportantMessage|The '''Raytracing Workbench''' is no longer included after version 0.20.<br>
The external [https://github.com/FreeCAD/FreeCAD-render Render Workbench] should be used instead.}}

[[Image:Workbench_Raytracing.svg|thumb|128px|Raytracing workbench icon]]

<span id="Introduction"></span>
== Introdução ==

{{TOCright}}

The [[Image:Workbench_Raytracing.svg|24px]] [[Raytracing_Workbench|Raytracing Workbench]] is used to generate photorealistic images of your models by processing them with an external renderer.

A bancada Raytracing trabalha com [[Raytracing templates | templates]], que são arquivos de projeto que definem uma cena para seu modelo 3D. Você pode colocar luzes e geometrias, como planos de base, e também contém espaços reservados para a posição da câmera e para as informações do material dos objetos na cena. O projeto pode ser exportado para um arquivo pronto para renderização ou renderizado diretamente no FreeCAD.

Atualmente, dois renderizadores são suportados: [http://en.wikipedia.org/wiki/POV-Ray povray] e [http://en.wikipedia.org/wiki/LuxRender luxrender]. Para poder renderizar a partir do FreeCAD, pelo menos um desses programas deve ser instalado e configurado em seu sistema. No entanto, se nenhum renderizador estiver instalado, você ainda poderá exportar um arquivo de projeto para ser renderizado em outro momento.

<div class="mw-translate-fuzzy">
The Raytracing workbench is essentially obsolete. New development is happening in the [https://github.com/FreeCAD/FreeCAD-render Render Workbench], which is intended as its replacement. This workbench is fully programmed in Python so it is much easier to extend than the current workbench which is programmed in C++. Nevertheless, the information in this page is generally useful for the new workbench, as both modules work basically in the same way.
</div>


[[Image:Raytracing_example.jpg|1024px]]
[[Image:Raytracing_example.jpg|1024px]]


<div class="mw-translate-fuzzy">
Currenly, two renderers are supported: [http://en.wikipedia.org/wiki/POV-Ray povray] and [http://en.wikipedia.org/wiki/LuxRender luxrender]. To be able to render directly from FreeCAD, at least one of those renderers must be installed on your system, and its path must be configured in the FreeCAD Raytracing preferences. Without any renderer installed, though, you are still able to export a scene file that can be used in any of those renderers later, or on another machine.
== Fluxo de trabalho típico ==
# Crie ou abra um projeto do FreeCAD, adicione alguns objetos sólidos ([[Part_Workbench | Part-based]] ou [[PartDesign_Workbench | PartDesign-based]]); malhas atualmente não são suportadas.
# Crie um projeto de Raytracing (povray ou luxrender).
# Selecione os objetos que você deseja adicionar ao projeto Raytracing e adicione-os.
# Exportar o arquivo do projeto ou renderizá-lo diretamente.
</div>


The raytracing workbench works with [[Raytracing Module#Templates|templates]], which are complete scene files for the given external renderer, including lights and possibly additional geometry such as ground planes. These scene files contain placeholders, where FreeCAD will insert the position of the camera, and geometry and materials information of each of the objects you insert in the project. That modified scene file is what is then exported to the external renderer.


[[Image:Raytracing_Workbench_workflow.svg|600px]]
== Tools ==


{{Raytracing Tools}}


{{Caption | Fluxo de trabalho da bancada Raytracing; o ambiente de trabalho prepara um arquivo de projeto de um determinado modelo e, em seguida, chama um programa externo para produzir a renderização real da cena. O renderizador externo pode ser usado independentemente do FreeCAD.}}
== Typical workflow ==
# Create or open a FreeCAD project, add some [[Part Module|Part-based]] objects (meshes are currently not supported)
# Create a Raytracing project (luxrender or povray)
# Select the objects you wish to add to the raytracing project and add them to the project with the "Insert Part" tool
# Export or render directly


<span id="Tools"></span>
== Creating a povray file manually ==
== Ferramentas ==
The utility tools described above allow you to export the current 3D view and all of its content to a [http://www.povray.org/ Povray] file. First, you must load or create your CAD data and position the 3D View orientation as you wish. Then choose "Utilities->Export View..." from the raytracing menu.


<span id="Project_tools"></span>
[[Image:FreeCAD_Raytracing.jpg|center]]
===Ferramentas de Projeto===


<div class="mw-translate-fuzzy">
You will be asked for a location to save the resulting *.pov file. After that you can open it in [http://www.povray.org/ Povray] and render:
Essas são as principais ferramentas para exportar o seu trabalho 3D para os renderizadores externos:
* [[Image:Raytracing_New.png|32px]] [[Raytracing_New|Novo Projeto PovRay]]: Insere um novo projeto PovRay no documento.
* [[Image:Raytracing_Lux.png|32px]] [[Raytracing_Lux|Novo Projeto LuxRender]]: Insere um novo projeto LuxRender in no documento.
* [[Image:Raytracing_InsertPart.png|32px]] [[Raytracing_InsertPart|Inserir Peça]]: Insere uma vista de uma Peça em um projeto do Raytracing.
* [[Image:Raytracing_ResetCamera.png|32px]] [[Raytracing_ResetCamera|Redefinir camera]]: Corresponde a posição da câmera de um projeto Raytracing à visão atual.
* [[Image:Raytracing_ExportProject.png|32px]] [[Raytracing_ExportProject|Exportar projeto]]: Exporta um projeto raytracing para o arquivo de cena para renderizar em um renderizador externo.
* [[Image:Raytracing_Render.png|32px]] [[Raytracing_Render|Renderizador]]: Renderiza um projeto raytracing com um renderizador externo.
</div>


<span id="Utilities"></span>
[[Image:Povray.jpg|center]]
===Utilidades===


Estas são ferramentas auxiliares para realizar tarefas específicas manualmente.
As usual in a rendererer you can make big and nice pictures:
* [[Image:Raytracing_WriteView.svg|32px]] [[Raytracing_WriteView|Exportar vista para povray]]: Escreve uma vista 3D ativa com câmera e todo seu conteúdo para um arquivo povray.
* [[Image:Raytracing_WriteCamera.svg|32px]] [[Raytracing_WriteCamera|Exportar câmera para o povray]]: Exporta a posição da câmera de uma vista 3D ativa no formato POV-Ray para um arquivo.
* [[Image:Raytracing_WritePart.svg|32px]] [[Raytracing_WritePart|Exportar peça para o povray]]: Escreve a Peça selecionada (objeto) como um arquivo povray.


<span id="Preferences"></span>
[[Image:Scharniergreifer_render.jpg|1024px]]
== Preferências ==

* [[Image:Preferences-raytracing.svg|32px]] [[Raytracing_Preferences|Preferências]]: Preferências disponíveis nas ferramentas do Raytracing.

== Tutoriais ==
* [[Raytracing_tutorial|Basic Raytracing tutorial]]
* [[Tutorial FreeCAD POV ray|Intermediate Raytracing tutorial]]

== Criando um arquivo povray manualmente ==
As ferramentas de utilitário descritas acima permitem que você exporte a visualização 3D atual e todo o seu conteúdo para um arquivo [http://www.povray.org/Povray]. Primeiro, você deve carregar ou criar seus dados CAD e posicionar a orientação da vista 3D como desejar. Em seguida, escolha "Utilitários → Exportar vista ..." no menu raytracing

[[Image:FreeCAD_Raytracing.jpg|center]]

Você será perguntado por um local para salvar o arquivo * .pov resultante. Depois disso, você pode abri-lo em [http://www.povray.org/Povray] e renderizar:
[[Image:Povray.jpg|center]]

Como de costume em um renderizador você pode fazer fotos grandes e agradáveis:
[[Image:Scharniergreifer_render.jpg|center|800px]]


== Scripting ==
== Scripting ==


Consulte o [[Raytracing API example|Raytracing API example]] para obter informações sobre como escrever cenas programaticamente.
=== Outputting render files ===
The Raytracing and RaytracingGui modules provide several methods to write scene contents as povray or luxrender data. The most useful are Raytracing.getPartAsPovray() and Raytracing.getPartAsLux() to render a FreeCAD Part object into a povray or luxrender definition, and RaytracingGui.povViewCamera() and RaytracinGui.luxViewCamera() to get the current point of view of the FreeCAD 3D window into povray or luxrender format.


Here is how to write a povray file from python, assuming your document contains a "Box" object:
{{Code|code=
import Raytracing,RaytracingGui
OutFile = open('C:/Documents and Settings/jriegel/Desktop/test.pov','w')
OutFile.write(open(App.getResourceDir()+'Mod/Raytracing/Templates/ProjectStd.pov').read())
OutFile.write(RaytracingGui.povViewCamera())
OutFile.write(Raytracing.getPartAsPovray('Box',App.activeDocument().Box.Shape,0.800000,0.800000,0.800000))
OutFile.close()
del OutFile
}}
And the same for luxrender:
{{Code|code=
import Raytracing,RaytracingGui
OutFile = open('C:/Documents and Settings/jriegel/Desktop/test.lxs','w')
OutFile.write(open(App.getResourceDir()+'Mod/Raytracing/Templates/LuxClassic.lxs').read())
OutFile.write(RaytracingGui.luxViewCamera())
OutFile.write(Raytracing.getPartAsLux('Box',App.activeDocument().Box.Shape,0.800000,0.800000,0.800000))
OutFile.close()
del OutFile
}}
=== Creating a custom render object ===
Apart from standard povray and luxrender view objects that provide a view of an existing Part object, and that can be inserted in povray and luxrender projects respectively, a third object exist, called RaySegment, that can be inserted either in povray or luxrender projects. That RaySegment object is not linked to any of the FreeCAD objects, and can contain custom povray or luxrender code, that you might wish to insert into your raytracing project. You can also use it, for example, to output your FreeCAD objects a certain way, if you are not happy with the standard way. You can create and use it like this from the python console:
{{Code|code=
myRaytracingProject = FreeCAD.ActiveDocument.PovProject
myCustomRenderObject = FreeCAD.ActiveDocument.addObject("Raytracing::RaySegment","myRenderObject")
myRaytracingProject.addObject(myCustomRenderObject)
myCustomRenderObject.Result = "// Hello from python!"
}}
== Links ==
== Links ==


Line 73: Line 104:
* http://www.luxrender.net/
* http://www.luxrender.net/


=== Futuros possíveis renderizadores a serem implementados ===
=== Future possible renderers to implement ===
* http://www.yafaray.org/
* http://www.yafaray.org/
* http://www.mitsuba-renderer.org/
* http://www.mitsuba-renderer.org/
Line 79: Line 110:
* http://www.artofillusion.org/
* http://www.artofillusion.org/


== Exportando para Kerkythea ==
----
Embora a exportação direta para o formato de arquivo XML Kerkythea ainda não é suportada, você pode exportar seus objetos como arquivos de malha (.obj) e, em seguida, importá-los no Kerkythea.
Currently there is a new Renderer Workbench in development to support multiple back-ends such as Lux Renderer and Yafaray. Information for using the development version can be viewed at [[Render_project]]
* se estiver usando o Kerkythea para Linux, lembre-se de instalar o WINE-Package (necessário para o Kerkythea Linux rodar)
* você pode converter seus modelos com a ajuda da bancada Malha para malhas e exportar essas malhas como arquivos .obj
* Se a sua malha de exportação resultou em erros (flip de normais, buracos ...) você pode tentar a sorte com [http://www.netfabb.com/downloadcenter.php?basic=1 netfabb studio basic]
: Gratuito para uso pessoal, disponível para Windows, Linux e Mac OSX.
: Possui ferramentas de reparo padrão que irão reparar seu modelo na maioria dos casos.
* Outro bom programa para análise / reparo de malhas é o [http://sourceforge.net/projects/meshlab/ Meshlab]
: Open Source, disponível para Windows, Linux e Mac OSX.
: Possui ferramentas de reparo padrão que reparam o modelo na maioria dos casos (preenche buracos, reorienta as normais, etc.)
* você pode usar "make compound" e então "make single copy" ou você pode fundir sólidos para agrupá-los antes de converter em malhas
* Lembre-se de definir em Kerkythea um fator de importação de 0.001 para o obj-modeler, já que Kerkythea espera que o arquivo obj esteja em m (mas o esquema de unidades padrão no FreeCAD é mm)
: No Windows 7, o Kerkythea de 64 bits não parece conseguir salvar essas configurações.
: Então lembre-se de fazer isso toda vez que você começar Kerkythea
* Ao importar vários objetos no Kerkythea, você pode usar o comando "Arquivo → Mesclar" no Kerkythea


==Development==
For Development status of the Render Module look here [[Raytracing_project]]


These pages refer to the new workbench, programmed in Python, meant to replace the current Raytracing Workbench.
== Templates ==
* [https://github.com/FreeCAD/FreeCAD-render Render Workbench]
FreeCAD comes with a couple of default templates for povray and luxrender, but you can easily create your own. All you need to do is to create a scene file for the given renderer, then edit it manually with a text editor to insert special tags that FreeCAD will recognize and where it will insert its contents (camera and objects data)
* [https://forum.freecadweb.org/viewtopic.php?f=9&t=25933 Render Workbench] (announcement only, no discussion)
* [https://forum.freecadweb.org/viewtopic.php?t=39168 FreeCAD Renderer Workbench improvements]


=== Povray ===
Povray scene files (with extension .pov) can be created manually with a text editor (povray is made primarily to be used as a scripting language), but also with a wide range of 3D applications, such as [http://www.blender.org blender]. On the [http://www.povray.org/ povray website] you can find further information and a list of applications able to produce .pov files.


<div class="mw-translate-fuzzy">
When you have a .pov file ready, you need to open it with a text editor, and do two operations:
{{Docnav
# Strip out the camera information, because FreeCAD will place its own camera data. To do so, locate a text block like this: <tt>camera { ... }</tt>, which describes the camera parameters, and delete it (or put "//" in front of each line to comment them out).
|[[Points_Workbench/pt-br|Bancadas de trabalho Points]]
# Insert the following line somewhere: <tt>//RaytracingContent</tt>. This is where FreeCAD will insert its contents (camera and objects data). You can, for example, put this line at the very end of the file.
|[[Reverse_Engineering_Workbench/pt-br|Bancadas de trabalho Reverse Engineering]]

|IconL=Workbench_Points.svg
Note that FreeCAD will also add some declarations, that you can use in your template, after the <tt>//RaytracingContent</tt> tag. These are:
|IconR=Workbench_Reverse_Engineering.svg
* cam_location: the location of the camera
* cam_look_at: the location of the target point of the camera
* cam_sky: the up vector of the camera.
* cam_angle: the angle of the camera

If you want, for example, to place a lamp above the camera, you can use this:
{{Code|code=
light_source {
cam_location + cam_angle * 100
color rgb <10, 10, 10>
}
}}
}}
</div>
=== Luxrender ===
Luxrender scene files (with extension.lxs) can either be single files, or a master .lxs file that includes world definition (.lxw), material definition (.lxm) and geometry definition (.lxo) files. You can work with both styles, but it is also easy to transform a group of 4 files in a single .lxs file, by copying the contents of each .lxw, .lxm and .lxo file and pasting it at the point where that file is inserted in the master .lxs file.

Luxrender scene files are hard to produce by hand, but are easy to produce with many 3D applications such as [http://www.blender.org blender]. On the [http://www.luxrender.net luxrender website], you'll find more information and plugins for the main 3D applications out there.

If you will work with separated .lxw, .lxm and .lxo files, beware that the final .lxs exported by FreeCAD might be at a different location than the template file, and therefore these files might not be found by Luxrender at render time. In this case you should or copy these files to the location of your final file, or edit their paths in the exported .lxs file.


{{Raytracing Tools navi{{#translation:}}}}
If you are exporting a scene file from blender, and wish to merge everything into one single file, you will need to perform one step before exporting: By default, the luxrender exporter in blender exports all mesh geometry as separate .ply files, instead of placing the mesh geometry directly inside the .lxo file. To change that behaviour, you need to select each of your meshes in blender, go to the "mesh" tab and set the option "export as" to "luxrender mesh" for each one of them.
{{Userdocnavi{{#translation:}}}}

[[Category:Obsolete Workbenches{{#translation:}}]]
After you have your scene file ready, to turn it into a FreeCAD template, you need to perform the following steps:
# Locate the camera position, a single line that begins with <tt>LookAt</tt>, and delete it (or place a "#" at the beginning of the line to comment it out)
# At that place, insert the following line: <tt>#RaytracingCamera</tt>
# At a desired point, for example just after the end of the materials definition, before the geometry information, or at the very end, just before the final <tt>WorldEnd</tt> line, insert the following line: <tt>#RaytracingContent</tt>. That is where FreeCAD will insert its own objects.

Note that in luxrender, the objects stored in a scene file can define transformation matrixes, that perform location, rotation or scaling operations. These matrixes can stack and affect everything that come after them, so, by placing your <tt>#RaytracingContent</tt> tag at the end of the file, you might see your FreeCAD objects affected by a transformation matrix placed earlier in the template. To make sure that this doesn't happen, place your <tt>#RaytracingContent</tt> tag before any other geometry object present in the template. FreeCAD itself won't define any of those transformation matrixes.

== Exporting to Kerkythea ==
Although direct export to the Kerkythea XML-File-Format is not supported yet, you can export your Objects as Mesh-Files (.obj) and then import them in Kerkythea.
* if using Kerkythea for Linux, remember to install the WINE-Package (needed by Kerkythea for Linux to run)
* you can convert your models with the help of the mesh workbench to meshes and then export these meshes as .obj-files
* you can use "make compound" and then "make single copy" or you can fuse solids to group them before converting to meshes
* remember to set in Kerkythea an import-factor of 0.001 for obj-modeler, since Kerkythea expects the obj-file to be in m (but standard units-scheme in FreeCAD is mm)
* if importing multiple objects in Kerkythea you can use the "File > Merge" command in Kerkythea

{{docnav/pt-br|Drawing Module/pt-br|Image Module/pt-br}}

[[Category:User Documentation/pt-br]]
{{clear}}
<languages/>

Latest revision as of 16:17, 3 May 2023

The Raytracing Workbench is no longer included after version 0.20.
The external Render Workbench should be used instead.
Raytracing workbench icon

Introdução

The Raytracing Workbench is used to generate photorealistic images of your models by processing them with an external renderer.

A bancada Raytracing trabalha com templates, que são arquivos de projeto que definem uma cena para seu modelo 3D. Você pode colocar luzes e geometrias, como planos de base, e também contém espaços reservados para a posição da câmera e para as informações do material dos objetos na cena. O projeto pode ser exportado para um arquivo pronto para renderização ou renderizado diretamente no FreeCAD.

Atualmente, dois renderizadores são suportados: povray e luxrender. Para poder renderizar a partir do FreeCAD, pelo menos um desses programas deve ser instalado e configurado em seu sistema. No entanto, se nenhum renderizador estiver instalado, você ainda poderá exportar um arquivo de projeto para ser renderizado em outro momento.

The Raytracing workbench is essentially obsolete. New development is happening in the Render Workbench, which is intended as its replacement. This workbench is fully programmed in Python so it is much easier to extend than the current workbench which is programmed in C++. Nevertheless, the information in this page is generally useful for the new workbench, as both modules work basically in the same way.

Fluxo de trabalho típico

  1. Crie ou abra um projeto do FreeCAD, adicione alguns objetos sólidos ( Part-based ou PartDesign-based); malhas atualmente não são suportadas.
  2. Crie um projeto de Raytracing (povray ou luxrender).
  3. Selecione os objetos que você deseja adicionar ao projeto Raytracing e adicione-os.
  4. Exportar o arquivo do projeto ou renderizá-lo diretamente.



Fluxo de trabalho da bancada Raytracing; o ambiente de trabalho prepara um arquivo de projeto de um determinado modelo e, em seguida, chama um programa externo para produzir a renderização real da cena. O renderizador externo pode ser usado independentemente do FreeCAD.

Ferramentas

Ferramentas de Projeto

Essas são as principais ferramentas para exportar o seu trabalho 3D para os renderizadores externos:

  • Novo Projeto PovRay: Insere um novo projeto PovRay no documento.
  • Novo Projeto LuxRender: Insere um novo projeto LuxRender in no documento.
  • Inserir Peça: Insere uma vista de uma Peça em um projeto do Raytracing.
  • Redefinir camera: Corresponde a posição da câmera de um projeto Raytracing à visão atual.
  • Exportar projeto: Exporta um projeto raytracing para o arquivo de cena para renderizar em um renderizador externo.
  • Renderizador: Renderiza um projeto raytracing com um renderizador externo.

Utilidades

Estas são ferramentas auxiliares para realizar tarefas específicas manualmente.

Preferências

  • Preferências: Preferências disponíveis nas ferramentas do Raytracing.

Tutoriais

Criando um arquivo povray manualmente

As ferramentas de utilitário descritas acima permitem que você exporte a visualização 3D atual e todo o seu conteúdo para um arquivo [1]. Primeiro, você deve carregar ou criar seus dados CAD e posicionar a orientação da vista 3D como desejar. Em seguida, escolha "Utilitários → Exportar vista ..." no menu raytracing

Você será perguntado por um local para salvar o arquivo * .pov resultante. Depois disso, você pode abri-lo em [2] e renderizar:

Como de costume em um renderizador você pode fazer fotos grandes e agradáveis:

Scripting

Consulte o Raytracing API example para obter informações sobre como escrever cenas programaticamente.

Links

POVRay

Luxrender

Futuros possíveis renderizadores a serem implementados

Exportando para Kerkythea

Embora a exportação direta para o formato de arquivo XML Kerkythea ainda não é suportada, você pode exportar seus objetos como arquivos de malha (.obj) e, em seguida, importá-los no Kerkythea.

  • se estiver usando o Kerkythea para Linux, lembre-se de instalar o WINE-Package (necessário para o Kerkythea Linux rodar)
  • você pode converter seus modelos com a ajuda da bancada Malha para malhas e exportar essas malhas como arquivos .obj
  • Se a sua malha de exportação resultou em erros (flip de normais, buracos ...) você pode tentar a sorte com netfabb studio basic
Gratuito para uso pessoal, disponível para Windows, Linux e Mac OSX.
Possui ferramentas de reparo padrão que irão reparar seu modelo na maioria dos casos.
  • Outro bom programa para análise / reparo de malhas é o Meshlab
Open Source, disponível para Windows, Linux e Mac OSX.
Possui ferramentas de reparo padrão que reparam o modelo na maioria dos casos (preenche buracos, reorienta as normais, etc.)
  • você pode usar "make compound" e então "make single copy" ou você pode fundir sólidos para agrupá-los antes de converter em malhas
  • Lembre-se de definir em Kerkythea um fator de importação de 0.001 para o obj-modeler, já que Kerkythea espera que o arquivo obj esteja em m (mas o esquema de unidades padrão no FreeCAD é mm)
No Windows 7, o Kerkythea de 64 bits não parece conseguir salvar essas configurações.
Então lembre-se de fazer isso toda vez que você começar Kerkythea
  • Ao importar vários objetos no Kerkythea, você pode usar o comando "Arquivo → Mesclar" no Kerkythea

Development

These pages refer to the new workbench, programmed in Python, meant to replace the current Raytracing Workbench.