Raytracing Workbench/ru: Difference between revisions

From FreeCAD Documentation
(Updating to match new version of source page)
(Created page with "Эти страницы ссылаются на аналогичный верстак, запрограммированный на C++, предложенный примерн...")
(44 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<languages/>
<languages/>
{{Docnav/ru
Этот модуль предназначен для создания фотореалистичной изображения ваших моделей с помощью внешних программ рендеринга. Модуль работает с помощью [[#Templates|шаблонов]], точно так же как [[Drawing Module/ru|верстак Drawing]], позволяя создать проект трассировки лучей, куда Вы можете добавить виды ваших объектов. Проект может быть экспортирован в готовый для рендеринга файл, или отрисован напрямую.
|[[Points Workbench/ru|Points Workbench]]
|[[Reverse Engineering Workbench/ru|Reverse Engineering Workbench]]
|IconL=Workbench_Points.svg
|IconR=Workbench_Reverse_Engineering.svg
}}


{{VeryImportantMessage|Верстак Raytracing по сути устарел. Ведётся новая разработка [https://github.com/FreeCAD/FreeCAD-render верстака Render], который планируется как замена. Этот верстак полностью программируется на Python, поэтому его легче расширить.
[[Image:Raytracing_example.jpg|1024px]]


Тем не менее, информация на этой странице в общем полезна для нового верстака, и оба модуля в основе работают одинаково.
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.
}}


[[Image:Workbench_Raytracing.svg|thumb|128px|Raytracing workbench icon]]
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.


== Введение ==
=== GUI Инструменты ===


{{TOCright}}
{{Raytracing Tools/ru}}


[[Image:Workbench_Raytracing.svg|24px]] [[Raytracing Workbench/ru|Верстак Raytracing]] предназначен для создания фотореалистичной изображения ваших моделей с помощью внешних программ рендеринга.
== 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


Модуль работает с помощью [[Raytracing templates/ru|шаблонов]], это файлы проектов, определяющих сцену для вашей объёмной модели. Вы можете поместить свет и геометрию, вроде плоскости земли, и там содержится место для позиции камеры и для указания материалов объектов этой сцены. Проект может быть экспортирован в готовый для рендеринга файл, или отрисован напрямую в FreeCAD.
== Creating a povray file manually ==
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.


В настоящее время поддерживаются два визуализатора: [https://ru.wikipedia.org/wiki/POV-Ray povray] и [http://ru.wikipedia.org/wiki/LuxRender luxrender]. Чтобы иметь возможность визуализации из FreeCAD, нужна хотя бы одна из этих программ, установленная и сконфигурированная в Вашей системе. Но даже если ни одного визуализатора не установлено, Вы можете экспортировать файл проекта для визуализации впоследствии.
[[Image:FreeCAD_Raytracing.jpg|center]]


Верстак Raytracing по сути устарел. Ведётся новая разработка [https://github.com/FreeCAD/FreeCAD-render верстака Render], который предназначен для его замены. Этот верстак полностью запрограммирован на Python, поэтому его гораздо проще расширить, чем текущий верстак, который запрограммирован на C ++. Тем не менее, информация на этой странице в целом полезна для нового верстака, так как оба модуля работают в основном одинаково.
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:


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


== Типичная работа ==
As usual in a renderer you can make big and nice pictures:
# Создайте или откройте прокет FreeCAD, добавьте некоторые твердотельные объекты модулей ([[Part Module/ru|Part]] или [[PartDesign Workbench/ru|PartDesign]]); сетки пока не поддерживаются.
# Создайте проект трассировки лучей (для povray или luxrender).
# Выделите объекты, которые Вы хотите добавить в проект трассировки лучей и добавьте их.
# Экспортируйте файл проекта или визуализируйте его напрямую.


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


[[Image:Raytracing_Workbench_workflow.svg|600px]]
=== Написание сценариев ===


=== 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.


{{Caption|Работа верстака Raytracing; верстак готовит файл проекта из данного шаблона, затем вызывает внешнюю программу для визуализации сцены. Внешний визуализатор может использоваться независимо от FreeCAD.}}
Вот как использовать эти функции в python:
{{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!"
}}
=== Ссылки ===


== Инструменты ==
=== POVRay===
* http://www.spiritone.com/~english/cyclopedia/
* http://www.povray.org/
* http://en.wikipedia.org/wiki/POV-Ray


===Инструменты проекта===
=== Luxrender ===
* http://www.luxrender.net/


Это главные инструменты для экспорта Вашей трёхмерной работы во внешние визуализаторы.
=== Future possible renderers to implement ===
* [[Image:Raytrace_New.svg|32px]] [[Raytracing_New/ru|New PovRay project]]: Вставляет в документ новый проект PovRay
* http://www.yafaray.org/
* [[Image:Raytrace_Lux.svg|32px]] [[Raytracing_Lux/ru|New LuxRender project]]: Вставляет в документ новый проект LuxRender
* http://www.mitsuba-renderer.org/
* [[Image:Raytrace_NewPartSegment.svg|32px]] [[Raytracing_InsertPart/ru|Insert part]]: Вставляет вид объекта Part в проект визуализации
* http://www.kerkythea.net/
* [[Image:Raytrace_ResetCamera.svg|32px]] [[Raytracing_ResetCamera/ru|Reset camera]]: Сопоставляет позицию камеры проекта трассировки лучей с текущим видом
* http://www.artofillusion.org/
* [[Image:Raytrace_ExportProject.svg|32px]] [[Raytracing_ExportProject/ru|Export project]]: Экспортирует проект визуализации в файл сцены для отрисовки во внешнем визуализаторе
* [[Image:Raytrace_Render.svg|32px]] [[Raytracing_Render/ru|Render]]: Визуализирует проект трассировки лучей во внешнем визуализаторе


===Утилиты===
----
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]]


Это вспомогательные инструменты для ручного выполнения особых задач.
For Development status of the Render Module look here [[Raytracing_project]]
* [[Image:Raytrace_Export.svg|32px]] [[Raytracing_Export/ru|Export view to povray]]: Записывает активный трёхмерный вид с камерой и содержимым в файл povray
* [[Image:Raytrace_Camera.svg|32px]] [[Raytracing_Camera/ru|Export camera to povray]]: Экспортирует позицию камеры активного трёхмерного вида в формате POV-Ray в файл
* [[Image:Raytrace_Part.svg|32px]] [[Raytracing_Part/ru|Export part to povray]]: Записывает выделенный объект Part как файл povray


== Templates ==
== Настройки ==
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). Personal templates can be placed under the path ~/.FreeCAD/data/Mod/Raytracing/Templates {{Version|0.18}}.


* [[Image:Preferences-raytracing.svg|32px]] [[Raytracing_Preferences/ru|Preferences]]: Доступные настройки для инструментов Raytracing.
=== 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.


== Учебники ==
When you have a .pov file ready, you need to open it with a text editor, and do two operations:
* [[Raytracing_tutorial/ru|Базовый учебник Raytracing]]
# 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).
* [[Tutorial FreeCAD POV ray/ru|Учебник Raytracing среднего уровня]]
# 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.


== Ручное создание файла povray ==
Note that FreeCAD will also add some declarations, that you can use in your template, after the <tt>//RaytracingContent</tt> tag. These are:
Описанные выше вспомогательные инструменты позволяют экспортировать текущий трёхмерный вид и его содержимое в файл [http://www.povray.org/ Povray]. Сначала вы должны загрузить или создать данные САПР и расположить ориентацию трёхмерного вида по своему желанию. Затем выберите из меню трассировки "Вспомогательные → Экспорт вида...".
* 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


[[Image:FreeCAD_Raytracing.jpg|center]]
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>
}
}}
=== 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.


У Вас уточнят положение для сохранения итогового файла *.pov. После этого Вы можете открыть его в [http://www.povray.org/ Povray] и визуализировать:
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.
[[Image:Povray.jpg|center]]


Как обычно, в визуализаторе Вы сможете сделать большие и красивые картинки:
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.
[[Image:Scharniergreifer_render.jpg|center|800px]]


== Написание сценариев ==
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.


Смотрите [[Raytracing API example/ru|Примеры программного интерфейса Raytracing]] для информации о создании сцен через программирование.
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.

=== POVRay===
* http://www.spiritone.com/~english/cyclopedia/
* http://www.povray.org/
* http://en.wikipedia.org/wiki/POV-Ray

=== Luxrender ===
* http://www.luxrender.net/

=== Future possible renderers to implement ===
* http://www.yafaray.org/
* http://www.mitsuba-renderer.org/
* http://www.kerkythea.net/
* http://www.artofillusion.org/


== Exporting to Kerkythea ==
== Exporting to Kerkythea ==
Line 138: Line 112:
:Within WIndows 7 64-bit Kerkythea does not seem to be able to save these settings.
:Within WIndows 7 64-bit Kerkythea does not seem to be able to save these settings.
:So remember to do that each time you start Kerkythea
:So remember to do that each time you start Kerkythea
* if importing multiple objects in Kerkythea you can use the "File > Merge" command in Kerkythea
* if importing multiple objects in Kerkythea you can use the "File Merge" command in Kerkythea


==Разработка==
==Links==
* [[Render_project|Render project]]
* [[Raytracing_tutorial|Raytracing tutorial]]


Эти страницы ссылаются на новую рабочую среду, запрограммированную на Python, предназначенную для замены текущей Raytracing Workbench.
* [https://github.com/FreeCAD/FreeCAD-render Верстак Render]
* [https://forum.freecadweb.org/viewtopic.php?f=9&t=25933 Верстак Render] (только анонс, без дискуссии)
* [https://forum.freecadweb.org/viewtopic.php?t=39168 FreeCAD Renderer Workbench improvements]


'''Устарел'''
{{docnav/ru|Drawing Module/ru|Draft Module/ru}}

Эти страницы ссылаются на аналогичный верстак, запрограммированный на C++, предложенный примерно в 2012, но не завершённый.
* [[Raytracing_project/ru|Raytracing project]]
* [[Render_project/ru|Render project]]

{{Docnav/ru
|[[Points Workbench/ru|Points Workbench]]
|[[Reverse Engineering Workbench/ru|Reverse Engineering Workbench]]
|IconL=Workbench_Points.svg
|IconR=Workbench_Reverse_Engineering.svg
}}


{{Raytracing Tools navi{{#translation:}}}}
[[Category:User Documentation/ru]]
{{Userdocnavi{{#translation:}}}}
[[Category:Workbenches{{#translation:}}]]

Revision as of 08:05, 16 May 2020

Верстак Raytracing по сути устарел. Ведётся новая разработка верстака Render, который планируется как замена. Этот верстак полностью программируется на Python, поэтому его легче расширить.

Тем не менее, информация на этой странице в общем полезна для нового верстака, и оба модуля в основе работают одинаково.

Raytracing workbench icon

Введение

Верстак Raytracing предназначен для создания фотореалистичной изображения ваших моделей с помощью внешних программ рендеринга.

Модуль работает с помощью шаблонов, это файлы проектов, определяющих сцену для вашей объёмной модели. Вы можете поместить свет и геометрию, вроде плоскости земли, и там содержится место для позиции камеры и для указания материалов объектов этой сцены. Проект может быть экспортирован в готовый для рендеринга файл, или отрисован напрямую в FreeCAD.

В настоящее время поддерживаются два визуализатора: povray и luxrender. Чтобы иметь возможность визуализации из FreeCAD, нужна хотя бы одна из этих программ, установленная и сконфигурированная в Вашей системе. Но даже если ни одного визуализатора не установлено, Вы можете экспортировать файл проекта для визуализации впоследствии.

Верстак Raytracing по сути устарел. Ведётся новая разработка верстака Render, который предназначен для его замены. Этот верстак полностью запрограммирован на Python, поэтому его гораздо проще расширить, чем текущий верстак, который запрограммирован на C ++. Тем не менее, информация на этой странице в целом полезна для нового верстака, так как оба модуля работают в основном одинаково.

Типичная работа

  1. Создайте или откройте прокет FreeCAD, добавьте некоторые твердотельные объекты модулей (Part или PartDesign); сетки пока не поддерживаются.
  2. Создайте проект трассировки лучей (для povray или luxrender).
  3. Выделите объекты, которые Вы хотите добавить в проект трассировки лучей и добавьте их.
  4. Экспортируйте файл проекта или визуализируйте его напрямую.



Работа верстака Raytracing; верстак готовит файл проекта из данного шаблона, затем вызывает внешнюю программу для визуализации сцены. Внешний визуализатор может использоваться независимо от FreeCAD.

Инструменты

Инструменты проекта

Это главные инструменты для экспорта Вашей трёхмерной работы во внешние визуализаторы.

  • New PovRay project: Вставляет в документ новый проект PovRay
  • New LuxRender project: Вставляет в документ новый проект LuxRender
  • Insert part: Вставляет вид объекта Part в проект визуализации
  • Reset camera: Сопоставляет позицию камеры проекта трассировки лучей с текущим видом
  • Export project: Экспортирует проект визуализации в файл сцены для отрисовки во внешнем визуализаторе
  • Render: Визуализирует проект трассировки лучей во внешнем визуализаторе

Утилиты

Это вспомогательные инструменты для ручного выполнения особых задач.

Настройки

  • Preferences: Доступные настройки для инструментов Raytracing.

Учебники

Ручное создание файла povray

Описанные выше вспомогательные инструменты позволяют экспортировать текущий трёхмерный вид и его содержимое в файл Povray. Сначала вы должны загрузить или создать данные САПР и расположить ориентацию трёхмерного вида по своему желанию. Затем выберите из меню трассировки "Вспомогательные → Экспорт вида...".

У Вас уточнят положение для сохранения итогового файла *.pov. После этого Вы можете открыть его в Povray и визуализировать:

Как обычно, в визуализаторе Вы сможете сделать большие и красивые картинки:

Написание сценариев

Смотрите Примеры программного интерфейса Raytracing для информации о создании сцен через программирование.

Ссылки

POVRay

Luxrender

Future possible renderers to implement

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
  • If your mesh-export resulted in errors (flip of normals, holes ...) you may try your luck with netfabb studio basic
Free for personal use, available for Windows, Linux and Mac OSX.
It has standard repair tools which will repair you model in most cases.
  • another good program for mesh analysing/repairing is Meshlab
Open Source, available for Windows, Linux and Mac OSX.
It has standard repair tools which will repair you model in most cases (fill holes, re-orient normals, etc.)
  • 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)
Within WIndows 7 64-bit Kerkythea does not seem to be able to save these settings.
So remember to do that each time you start Kerkythea
  • if importing multiple objects in Kerkythea you can use the "File → Merge" command in Kerkythea

Разработка

Эти страницы ссылаются на новую рабочую среду, запрограммированную на Python, предназначенную для замены текущей Raytracing Workbench.

Устарел

Эти страницы ссылаются на аналогичный верстак, запрограммированный на C++, предложенный примерно в 2012, но не завершённый.