View topic - Yafaray standalone?

Yafaray standalone?

Post here general questions about usage of YafaRay and about the Blender Exporter UI

Yafaray standalone?

Post Tue Dec 31, 2013 7:35 pm

A couple of questions:

Can Yafaray be used without also using Blender?
Does Yafaray have a scene description language like POV-Ray?

I'm looking for a possible replacement for POV-Ray for rendering my LDraw models. POV-Ray is OK but I heard Yafaray is faster.


Mike
posfan12
 
Posts: 10
Joined: Tue Dec 31, 2013 7:31 pm

Re: Yafaray standalone?

Post Fri Jan 03, 2014 2:43 am

It used to be possible to export a scene from Blender to an .xml file. You could then render on the command line using yafaray-xml.

Some of this will be out of date:
http://www.yafaray.org/community/forum/ ... =16&t=4435
http://www.yafaray.org/development/docu ... n/XMLspecs
http://www.yafaray.org/development/docu ... parameters
http://www.yafaray.org/community/forum/ ... =23&t=4997
User avatar
stoneage
 
Posts: 1241
Joined: Sun Dec 23, 2007 1:06 pm

Re: Yafaray standalone?

Post Sun Jan 05, 2014 2:53 am

Thank you for the information. The XML specs will be a real help.
posfan12
 
Posts: 10
Joined: Tue Dec 31, 2013 7:31 pm

Re: Yafaray standalone?

Post Tue Jan 07, 2014 4:30 am

posfan12,
I am not a Ldraw user but it looks like you can convert Ldraw (.dat) files to
Llightwave (.lwo) files... http://www.ldraw.org/OLD/download/win/ldraw2lws.shtml

Wings3D will let you import .lwo files. There is a YafaRay plugin being developed for Wings3D. Here is a thread in the Wings3D users forum discussing its development.... http://wings3d.com/forum/showthread.php?tid=331

The Wings3D YafaRay plugin uses the YafaRay standalone program to render. You can also export Wings3D files as YafaRay .xml files to study the xml code.

YafaRay user povmaniac has added support for Subsurface Scattering to his build of the YafaRay standalone program.

I am not so sure that YafaRay is faster than Pov-Ray but I am sure that I prefer YafaRay rendered images over Pov-Ray... :)

oort
oort
 
Posts: 221
Joined: Wed Jun 01, 2005 2:11 pm

Re: Yafaray standalone?

Post Fri Dec 12, 2014 8:38 pm

Hi evryone, I'm looking for a way to import an "exported yafaray xml file" back into blender; because I don't have the original scene.
I have only the xml file and I want to make changes and improve the scene,

is there any addon or converter to import "yafaray xml" into blender ?
thanks.
eMirage
 
Posts: 19
Joined: Thu Oct 23, 2008 5:24 am

Re: Yafaray standalone?

Post Sun Mar 11, 2018 12:22 pm

Is it possible to use expressions or formulas or routines in the XML code? That is one advantage of POV-Ray.

E.g. in POV-Ray you can have:

#declare foo = 50 * bar;

Or you can define macros that take parameters as input.

#macro foo(bar)
50 * bar
#end
posfan12
 
Posts: 10
Joined: Tue Dec 31, 2013 7:31 pm

Re: Yafaray standalone?

Post Sun Mar 11, 2018 3:27 pm

Hello,

I'm sorry but not at the moment. It's an interesting idea, though. I will keep it in mind in case we can implement something like that in future YafaRay versions.
User avatar
David Bluecame
 
Posts: 460
Joined: Mon Jan 21, 2013 12:42 pm
Location: Spain

Re: Yafaray standalone?

Post Sun Mar 11, 2018 3:31 pm

On the other side, we do actually support python and ruby bindings. Perhaps that could give you the functionality you are looking for...

We don't have currently any examples showing this (apart from Blender-Exporter). However, perhaps it would be useful if I write a small example in python showing how to render a simple scene using python (without Blender).

Please give me some time to come up with a small example.
User avatar
David Bluecame
 
Posts: 460
Joined: Mon Jan 21, 2013 12:42 pm
Location: Spain

Re: Yafaray standalone?

Post Sun Mar 11, 2018 4:56 pm

Hello,

I've put below an example to render a couple triangles and a point light with Python. I hope it helps you. You can get a lot more information by looking at Blender-Exporter python code.

This code assumes that the yafaray_v3 folder is in "C:\yafa-test\yafaray_v3"

Please try this, copy this code into a file "yafaray3_test.py" for example. Then, execute "python yafaray3_test.py" and check the generated file "test.png". I hope it helps.

Code: Select all
# ##### BEGIN GPL LICENSE BLOCK #####
#
#  This program is free software; you can redistribute it and/or
#  modify it under the terms of the GNU General Public License
#  as published by the Free Software Foundation; either version 2
#  of the License, or (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software Foundation,
#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####

# <pep8 compliant>

import sys
import os

TESTS_PATH = "C:\\yafa-test"
YAFARAY_PATH = TESTS_PATH + "\\yafaray_v3\\bin" #Modify according to your system
sys.path.append(YAFARAY_PATH)

# Set Library Search options
if sys.platform == 'win32':   #I think this is the easiest and most flexible way to set the search options for Windows DLL
    os.environ['PATH'] = YAFARAY_PATH
# For Linux and MacOSX, set the RPATH in all the .so and .dylib libraries to relative paths respect to their location

import yafaray_v3_interface
yi = yafaray_v3_interface.yafrayInterface_t()
yi.setConsoleVerbosityLevel("debug")
yi.loadPlugins(YAFARAY_PATH + "\\yafaray-plugins")

yi.startScene()

yi.paramsClearAll()
yi.paramsSetInt("width", 400)
yi.paramsSetInt("height", 300)
yi.paramsSetString("type", "png")
ih = yi.createImageHandler(TESTS_PATH + "\\test.png")
co = yafaray_v3_interface.imageOutput_t(ih, TESTS_PATH + "\\test.png", 0, 0)

yi.paramsClearAll()
yi.paramsSetString("type", "perspective")
yi.paramsSetFloat("focal", 1.0)
yi.paramsSetInt("resx", 800)
yi.paramsSetInt("resy", 600)
yi.paramsSetPoint("from", 0.0, 0.0, 10.0)
yi.paramsSetPoint("up", 1.0, 0.0, 0.0)
yi.paramsSetPoint("to", 0.0, 0.0, 0.0)
yi.createCamera("camera1")

yi.paramsClearAll()
yi.paramsSetString("type", "directlighting")
yi.createIntegrator("integrator1")

yi.paramsClearAll()
yi.paramsSetString("type", "none")
yi.createIntegrator("volintegr1")

yi.paramsSetString("type", "shinydiffusemat")
yi.paramsSetColor("color", 1.0, 0.0, 0.0)  #Let's try a red material
mat1 = yi.createMaterial("material1")

yi.paramsSetString("type", "shinydiffusemat")
yi.paramsSetColor("color", 0.0, 1.0, 0.0)  #Let's try a green material
mat2 = yi.createMaterial("material2")

yi.paramsClearAll()
ID = yi.getNextFreeID()
yi.startGeometry()
vertices = 6
faces = 2
yi.startTriMesh(ID, vertices, faces, False, False, 0, 0)
yi.addVertex(0.0, 0.0, 0.0) #vertex 0
yi.addVertex(1.0, 0.0, 0.0) #vertex 1
yi.addVertex(1.0, 1.0, 0.0) #vertex 2
yi.addVertex(1.0, 1.0, 0.0) #vertex 3
yi.addVertex(2.0, 1.0, 0.0) #vertex 4
yi.addVertex(2.0, 2.0, 0.0) #vertex 5
yi.addTriangle(0, 1, 2, mat1)
yi.addTriangle(3, 4, 5, mat2)
yi.endTriMesh()
yi.endGeometry()

yi.paramsClearAll()
yi.paramsSetString("type", "pointlight")
yi.paramsSetPoint("from", 1.0, 1.0, 1.0)
yi.paramsSetColor("color", 1.0, 1.0, 1.0)
yi.paramsSetFloat("power", 2.0)
yi.paramsSetBool("light_enabled", True)
yi.createLight("light1")

yi.paramsClearAll()
yi.paramsSetInt("width", 400)
yi.paramsSetInt("height", 300)
yi.paramsSetString("camera_name", "camera1")
yi.paramsSetString("integrator_name", "integrator1")
yi.paramsSetString("volintegrator_name", "volintegr1")
yi.render(co)

test_number = 3 * 4
yi.printInfo("TEST: This is a test using YafaRay print function, test_number=" + str(test_number) + ")")
User avatar
David Bluecame
 
Posts: 460
Joined: Mon Jan 21, 2013 12:42 pm
Location: Spain

Re: Yafaray standalone?

Post Sun Mar 11, 2018 5:01 pm

FYI, this is the log and result image that I got in my Windows 10 64bit PC while running this.

For this test, I got the YafaRay v3 from here: http://www.yafaray.org/daily_builds/YafaRay%20v3.3.0-5-g3a98966%20Standalone%20build%20MinGW%20for%20Win7,%20Win8.1,%20Win10%2064bit.zip

I hope this helps you to get what you want (programmable/scriptable material & geometry generation, I suppose).

test.png
test.png (2.41 KiB) Viewed 2367 times


Code: Select all
[16:45:32] INFO: YafaRay Core (v3.3.0-5-g3a98966) Windows 64bit MinGW GCC
[16:45:32] INFO: Environment: Loading plugins ...
[16:45:32] VERB: Environment: Registered Camera type 'angular'
[16:45:32] VERB: Environment: Registered Light type 'arealight'
[16:45:32] VERB: Environment: Registered Light type 'bgPortalLight'
[16:45:32] VERB: Environment: Registered Light type 'meshlight'
[16:45:32] VERB: Environment: Registered ShaderNode type 'texture_mapper'
[16:45:32] VERB: Environment: Registered ShaderNode type 'value'
[16:45:32] VERB: Environment: Registered ShaderNode type 'mix'
[16:45:32] VERB: Environment: Registered ShaderNode type 'layer'
[16:45:32] VERB: Environment: Registered Texture type 'blend'
[16:45:32] VERB: Environment: Registered Texture type 'clouds'
[16:45:32] VERB: Environment: Registered Texture type 'marble'
[16:45:32] VERB: Environment: Registered Texture type 'wood'
[16:45:32] VERB: Environment: Registered Texture type 'voronoi'
[16:45:32] VERB: Environment: Registered Texture type 'musgrave'
[16:45:32] VERB: Environment: Registered Texture type 'distorted_noise'
[16:45:32] VERB: Environment: Registered Texture type 'rgb_cube'
[16:45:32] VERB: Environment: Registered Texture type 'image'
[16:45:32] VERB: Environment: Registered Light type 'bglight'
[16:45:32] VERB: Environment: Registered Integrator type 'bidirectional'
[16:45:32] VERB: Environment: Registered Material type 'blend_mat'
[16:45:32] VERB: Environment: Registered Material type 'coated_glossy'
[16:45:32] VERB: Environment: Registered Integrator type 'DebugIntegrator'
[16:45:32] VERB: Environment: Registered Light type 'directional'
[16:45:32] VERB: Environment: Registered Integrator type 'directlighting'
[16:45:32] VERB: Environment: Registered Integrator type 'EmissionIntegrator'
[16:45:32] VERB: Environment: Registered Integrator type 'none'
[16:45:32] VERB: Environment: Registered VolumeRegion type 'ExpDensityVolume'
[16:45:32] VERB: Environment: Registered ImageHandler type 'exr'
[16:45:32] VERB: Environment: Registered Material type 'glass'
[16:45:32] VERB: Environment: Registered Material type 'mirror'
[16:45:32] VERB: Environment: Registered Material type 'null'
[16:45:32] VERB: Environment: Registered Material type 'glossy'
[16:45:32] VERB: Environment: Registered Background type 'gradientback'
[16:45:32] VERB: Environment: Registered ImageHandler type 'hdr'
[16:45:32] VERB: Environment: Registered Light type 'ieslight'
[16:45:32] VERB: Environment: Registered ImageHandler type 'jpg'
[16:45:32] VERB: Environment: Registered VolumeRegion type 'NoiseVolume'
[16:45:32] VERB: Environment: Registered Camera type 'orthographic'
[16:45:32] VERB: Environment: Registered Integrator type 'pathtracing'
[16:45:32] VERB: Environment: Registered Camera type 'perspective'
[16:45:32] VERB: Environment: Registered Camera type 'architect'
[16:45:32] VERB: Environment: Registered Integrator type 'photonmapping'
[16:45:32] VERB: Environment: Registered ImageHandler type 'png'
[16:45:32] VERB: Environment: Registered Light type 'pointlight'
[16:45:32] VERB: Environment: Registered Material type 'rough_glass'
[16:45:32] VERB: Environment: Registered Material type 'shinydiffusemat'
[16:45:32] VERB: Environment: Registered Material type 'light_mat'
[16:45:32] VERB: Environment: Registered Material type 'mask_mat'
[16:45:32] VERB: Environment: Registered Integrator type 'SingleScatterIntegrator'
[16:45:32] VERB: Environment: Registered Integrator type 'SkyIntegrator'
[16:45:32] VERB: Environment: Registered VolumeRegion type 'SkyVolume'
[16:45:32] VERB: Environment: Registered Light type 'spherelight'
[16:45:32] VERB: Environment: Registered Light type 'spotlight'
[16:45:32] VERB: Environment: Registered Integrator type 'SPPM'
[16:45:32] VERB: Environment: Registered Light type 'sunlight'
[16:45:32] VERB: Environment: Registered Background type 'sunsky'
[16:45:32] VERB: Environment: Registered Background type 'darksky'
[16:45:32] VERB: Environment: Registered Background type 'textureback'
[16:45:32] VERB: Environment: Registered Background type 'constant'
[16:45:32] VERB: Environment: Registered ImageHandler type 'tga'
[16:45:32] VERB: Environment: Registered ImageHandler type 'tif'
[16:45:32] VERB: Environment: Registered VolumeRegion type 'UniformVolume'
[16:45:32] VERB: Environment: Registered VolumetricHandler type 'beer'
[16:45:32] VERB: Environment: Registered VolumetricHandler type 'sss'
[16:45:32] DEBUG: denoiseEnabled=0 denoiseHLum=3 denoiseHCol=3
[16:45:32] VERB: Environment: Added ImageHandler 'C:\yafa-test\test.png' (png)!
[16:45:32] VERB: Environment: Added Camera 'camera1' (perspective)!
[16:45:32] INFO: Environment: View number=0, view name: '', camera name: 'camera1'
[16:45:32] VERB: Environment: Added Integrator 'integrator1' (directlighting)!
[16:45:32] VERB: Environment: Added Integrator 'volintegr1' (none)!
[16:45:32] VERB: Environment: Added Material 'material1' (shinydiffusemat)!
[16:45:32] VERB: Environment: Added Material 'material2' (shinydiffusemat)!
[16:45:32] VERB: Environment: Added Light 'light1' (pointlight)!
[16:45:32] DEBUG: Images autosave: none, 1, 300
[16:45:32] DEBUG: ImageFilm autosave: none, none, 1, 300
[16:45:32] WARNING: Environment: No AA filter defined defaulting to Box!
[16:45:32] VERB: Environment: Defaulting to Centre tiles order.
[16:45:32] VERB: Automatic Detection of Threads: Active.
[16:45:32] VERB: Number of Threads supported: [8].
[16:45:32] PARM: Using [8] Threads.
[16:45:32] VERB: Automatic Detection of Threads for Photon Mapping: Active.
[16:45:32] VERB: Number of Threads supported for Photon Mapping: [8].
[16:45:32] PARM: Using for Photon Mapping [8] Threads.
[16:45:32] DEBUG: adv_base_sampling_offset=0
[16:45:32] VERB: Scene: Mode "Triangle"
[16:45:32] INFO: Kd-Tree: Starting build (2 prims, cr:0.8 eb:0.33)
[16:45:32] VERB: Kd-Tree: Getting triangle bounds...
[16:45:32] VERB: Kd-Tree: Done.
[16:45:32] VERB: Kd-Tree: Starting recursive build...
[16:45:32] VERB: Kd-Tree: Stats (0.01s)
[16:45:32] VERB: Kd-Tree: used/allocated nodes: 3/256 (1.17188%)
[16:45:32] VERB: Kd-Tree: Primitives in tree: 2
[16:45:32] VERB: Kd-Tree: Interior nodes: 1 / leaf nodes: 2 (empty: 0 = 0%)
[16:45:32] VERB: Kd-Tree: Leaf prims: 2 (1 x prims in tree, leaf size: 1)
[16:45:32] VERB: Kd-Tree: => 1 prims per non-empty leaf
[16:45:32] VERB: Kd-Tree: Leaves due to depth limit/bad splits: 0/0
[16:45:32] VERB: Kd-Tree: clipped triangles: 4 (0 bad clips, 0 null clips)
[16:45:32] VERB: Scene: New scene bound is:(-0.002, -0.002, 0), (2.002, 2.002, 0)
[16:45:32] INFO: Scene: total scene dimensions: X=2.004, Y=2.004, Z=0, volume=0, Shadow Bias=0.0005 (auto), Ray Min Dist=5e-005 (auto)
[16:45:32] INFO: DirectLight: Photonmap building time: 0.0s (8 thread(s))
[16:45:32] VERB: Direct Light  RayDepth=5  | photon maps: 0.0s [8 thread(s)]
[16:45:32] PARM: DirectLight: Rendering 1 passes
[16:45:32] PARM: Min. 1 samples
[16:45:32] PARM: 1 per additional pass
[16:45:32] PARM: Resampled pixels floor: 0.0% (0 pixels)
[16:45:32] VERB: AA_sample_multiplier_factor: 1.0
[16:45:32] VERB: AA_light_sample_multiplier_factor: 1.0
[16:45:32] VERB: AA_indirect_sample_multiplier_factor: 1.0
[16:45:32] VERB: AA_detect_color_noise: 0
[16:45:32] VERB: AA threshold:0.1
[16:45:32] VERB: AA_variance_edge_size: 10
[16:45:32] VERB: AA_variance_pixels: 0
[16:45:32] VERB: AA_clamp_samples: 0.0
[16:45:32] VERB: AA_clamp_indirect: 0.0
[16:45:32] PARM: Max. 1 total samples
[16:45:32] INFO: Rendering pass 1 of 1...
Progress: [                                                          ] (0%)[16:45:32] INFO: DirectLight: Rendering pass 1 of 1...
[16:45:32] DEBUG: Sampling: samples=1 Offset=0 Base Offset=0  AA_pass_number=0
Progress: [##########################################################] (100%)
[16:45:32] INFO: DirectLight: Overall rendertime: 0.1s
[16:45:32] INFO: imageFilm: Flushing buffer (View number 0)...
[16:45:32] PARM: --------------------------------------------------------------------------------
[16:45:32] PARM: YafaRay (v3.3.0-5-g3a98966) Windows 64bit MinGW GCC | 400x300 | 1 passes | Render time: 0.091s | Total time: 0.091s | CPU threads=8
[16:45:32] PARM: Direct Light  RayDepth=5  | photon maps: 0.0s [8 thread(s)]
[16:45:32] PARM: AA Settings (volintegr1): Tile size=32 passes=1 samples=1 inc_samples=1 resamp.floor=0
[16:45:32] PARM: sample.mul=1 light.sam.mul=1 ind.sam.mul=1
[16:45:32] PARM: col.noise=0 AA thr=0.05 var.edge=10 var.pix=0 clamp=0 ind.clamp=0
[16:45:32] PARM: --------------------------------------------------------------------------------
[16:45:32] INFO: Saving image files
[16:45:32] INFO: PNGHandler: Saving RGB file as "C:\yafa-test\test.png"...
[16:45:32] DEBUG: m_Denoise=0 m_DenoiseHLum=3 m_DenoiseHCol=3
[16:45:32] VERB: PNGHandler: Done.
[16:45:32] VERB: imageFilm: Done.
[16:45:32] INFO: TEST: This is a test using YafaRay print function, test_number=12)
[16:45:32] VERB: Interface: Deleting scene...
[16:45:32] INFO: Kd-Tree: Freeing nodes...
[16:45:32] VERB: Kd-Tree: Done
[16:45:32] VERB: Interface: Deleting environment...
[16:45:32] INFO: Interface: Done.
[16:45:32] VERB: Session: ended
User avatar
David Bluecame
 
Posts: 460
Joined: Mon Jan 21, 2013 12:42 pm
Location: Spain

Re: Yafaray standalone?

Post Wed Mar 14, 2018 10:13 am

I have the following 3DS model. How would I load this into the scene? Can this be done using Python?

http://www.mediafire.com/file/nn6t0wvdx ... leocad.zip

(Also, is 3DS supported? I can convert to something else.)
posfan12
 
Posts: 10
Joined: Tue Dec 31, 2013 7:31 pm

Re: Yafaray standalone?

Post Wed Mar 14, 2018 8:39 pm

Hello,

Thank you for sharing your model.

You can use Blender from http://www.blender.org and import a 3DS file into it, then render it using YafaRay v3 for example.

I have done that, adjusted a bit the materials and lights and voila, here you are :-)

untitled - 001.png
User avatar
David Bluecame
 
Posts: 460
Joined: Mon Jan 21, 2013 12:42 pm
Location: Spain

Re: Yafaray standalone?

Post Wed Mar 14, 2018 8:43 pm

I have attached the Blender model I created based on your 3DS model to this message.

You need to download and install YafaRay v3.3.0 for Blender so you can render it the same way I did.

Thanks again! :-)
Attachments
ldr_red_rock_racer_new_leocad_blender_scene_file.zip
(2.38 MiB) Downloaded 38 times
User avatar
David Bluecame
 
Posts: 460
Joined: Mon Jan 21, 2013 12:42 pm
Location: Spain

Re: Yafaray standalone?

Post Thu Mar 15, 2018 3:37 am

Yes, but how do I do this using the standalone version of Yafaray (and XML or Python or whatever)? That is the whole point of this thread. I feel more comfortable with a text interface, and also have many dozens of models (some of them quite large at 2GB to 4GB in size) to convert and render.
posfan12
 
Posts: 10
Joined: Tue Dec 31, 2013 7:31 pm

Re: Yafaray standalone?

Post Thu Mar 15, 2018 5:31 am

You can use Blender and YafaRay, set in Render options "render to XML" instead of "Into Blender" and it will generate an XML file with the scene that you can render using yafaray-xml standalone.

On the other side I'm thinking about adding a new feature in the next yafaray v4 so you can use Blender+YafaRay to export the scene into other types of text files, perhaps Python... I have to think about it...
User avatar
David Bluecame
 
Posts: 460
Joined: Mon Jan 21, 2013 12:42 pm
Location: Spain

Next

Return to General Questions and Blender Exporter UI



Who is online

Users browsing this forum: No registered users and 8 guests

cron