# [Software] Bluerender, a rendering engine for LDD

## Recommended Posts

You do not need to do any GUI for it, simple textual COPY/PASTE inside Setup.txt (tho I rather see it named scene.sc), very easy: youjust show users one simple HOW TO and thats it...it would be one line, like:

/* basically a copy of @hrontos' elegant solution to this "problem" */
ChangeDecor(88074, "C:\somePathToMyDecors\someDecorOfMine.png");


I see, that would be very easy indeed. But 88074 is the design id, or the decoration id? If it's the design id, that would put the custom decor on ALL parts with that id, which is not probably what you want. If it's the decoration id, that would work but how would you know which one you have to replace? AFAIK it's not shown on LDD, or it is?

Also, many parts have more than one "decorable" sub-surface on them. For example, the minifig head has at least two: one for the face, another for the "ring" on the upper part of the head (probably has another one for the "back" face).

But for that reason I would like to have...ehm, I would like to ask you for two simple things:

• (maybe you already doing this, I do not know, anyway) put all the bricks into one multidimensional associative array where first element would be the respective brick having all attributes that comes with it from the .lxf, so one could access it like

bricksArray[9].name;
bricksArray[9].color;
bricksArray[9].matrix;
...etc.


...so this way I can easily find the brick I want by the name/color combination using the .log file below
• please make .log output from the cmd window when you importing the bricks or even better output .log of the bricks array

I see, i'll see what i can do :)

##### Share on other sites

I see, that would be very easy indeed. But 88074 is the design id, or the decoration id? If it's the design id, that would put the custom decor on ALL parts with that id, which is not probably what you want. If it's the decoration id, that would work but how would you know which one you have to replace? AFAIK it's not shown on LDD, or it is?

Actually it is EXACTLY what I want, yes: cos it works like you choose some not used decor in LDD (I mean such decormthat you know you will never ever use in Space theme, like I do not know, for example some Castle decor) and you will use it as an instance of one concrete decor you intend to (for example that castle decor will symbolize grid pattern for me), so every instance of this decor is meant as the same decor therefore YES, it should replace every instance of the respective decor, so it should be quite easy exactly as you have said...

Also, many parts have more than one "decorable" sub-surface on them. For example, the minifig head has at least two: one for the face, another for the "ring" on the upper part of the head (probably has another one for the "back" face).

We do not need to care about this at it is solved automatically by a logic and intension of the decor used: if I am replacing decor that is for back part of the torso than also the replaced decor will be there cos remember all we are doing is replacing decor not the way how or where it is used

I see, i'll see what i can do :)

Oh, great, thank you so much in advance!

##### Share on other sites

I think bluerender still much faster than POV-Ray low setting, at least in these case.

- Huge quantity of bricks. POV-Ray low setting still take long time to parsing. Bluerender parsing very fast. It always start to render very fast. (if no error)

- Many trans parts. Bluerender render trans parts almost the same speed as non-trans part. But POV-Ray slow down a lot rendering trans parts. (especially overlap/big/complicate trans parts)

Edited by bbqqq

##### Share on other sites

I think bluerender still much faster than POV-Ray low setting, at least in these case.

- Huge quantity of bricks. POV-Ray low setting still take long time to parsing. Bluerender parsing very fast. always start to render very fast. (if no error)

- Many trans parts. Bluerender render trans parts almost the same speed as non-trans part. But POV-Ray slow down a lot rendering trans part. (especially overlap/big/complicate trans parts)

+ POVRAY although great quality it renders trans parts not right (I said it before so I will not repeat it just summarizing...)

+ comapared to POVRAY's not even the low but lower quality settings like Q7 is having amazingly much more details like POVRAY at Q9+ with Final radiosity

So guys that said please lets really make BlueRender the best renderer for LDD ever and pay attention to every possible "advanced" features it may have, please, msx80, do not settle yourself with good when you can be THE BEST.

Edited by bublible

##### Share on other sites

As i said i'm not trying to compete with it :) This program started as a simple experiment with sunflow.

Well, I guess you should... Kinda

POV-Ray is good enough and LDD2POV-Ray is a very powerful thing, but both have some obvious limitations due to POV-Ray's age. SunFlow seems to be a really nice and newer rendering program.

Any plans on adding bevels/fixing geometry?

Also there is another program, Simlab Composer, I've seen some great Lego renders made in it. I believe it's also a more efficient tool than POV-Ray, yet there's still no proper converter...

##### Share on other sites

PROBLEM:

* IBL light (HDR image) does not work - all I get as output is completely black image

SOLVED: SunFlow is using reversed slashes in the file paths description (that is "/" instead of OS used "\"), so when I adapted to it it works

Edited by bublible

##### Share on other sites

@msx80

How did you enable the .png decor transparency in that minifig preview? When I make rectangular generic-mesh with UVS and apply uber shader with my .png texture that has transparent background and "spec 0 0 0" with "spec.blend 0" (according to the PDF these two settings should make my object transparent) the picture rendered by BlueRender has white bg instead, look:

Edited by bublible

##### Share on other sites

please, msx80, do not settle yourself with good when you can be THE BEST.

Now you're starting to sound like my mom :P

Any plans on adding bevels/fixing geometry?

Also there is another program, Simlab Composer, I've seen some great Lego renders made in it. I believe it's also a more efficient tool than POV-Ray, yet there's still no proper converter...

No plans for bevels or any other geometry preprocessing. That's a HUGE amount of work actually :)

PROBLEM:

* IBL light (HDR image) does not work - all I get as output is completely black image

SOLVED: SunFlow is using reversed slashes in the file paths description (that is "/" instead of OS used "\"), so when I adapted to it it works

Yes :) Btw, here you can download some example scenes, that cover many Sunflow functionalities. EDIT: if you have some bluerender renders with IBL i would love to see them!

@msx80

How did you enable the .png decor transparency in that minifig preview? When I make rectangular generic-mesh with UVS and apply uber shader with my .png texture that has transparent background and "spec 0 0 0" with "spec.blend 0" (according to the PDF these two settings should make my object transparent) the picture rendered by BlueRender has white bg instead, look:

Actually i found out quite surprisingly that Sunflow doesn't support alpha channel for textures! I implemented a small workaround: i baked the background color into the texture. I'm also looking into implementing alpha channel support into sunflow, which doesn't look hard.

Edited by msx80

##### Share on other sites

Now you're starting to sound like my mom :P

NO WAY!

No plans for bevels or any other geometry preprocessing. That's a HUGE amount of work actually :)

Hm, I think - seeing your skills- this should be done by flick of a wrist for you...did you noticed my "kind-of-solution" exactly to this in some previous post on this topic?

Yes :) Btw, here you can download some example scenes, that cover many Sunflow functionalities.

I know about it, in fact I downloaded immediately as I learned it is SunFlow - that zip is basically the source of my try-error phase now, I am learning from it just like you said

EDIT: if you have some bluerender renders with IBL i would love to see them!

Well, tho I managed to get it working the results are for some reasons too dark (almost extremely) and I do not know why? Probably still doing something wrong...

Actually i found out quite surprisingly that Sunflow doesn't support alpha channel for textures! I implemented a small workaround: i baked the background color into the texture. I'm also looking into implementing alpha channel support into sunflow, which doesn't look hard.

Aha, so no error on my side, uff!

Happy hearing you are able to implement alpha channel tho original SunFlow code does not support it - that is absolutely essential for my work cos "backing the bg" would be of no use for me , so all fingers crossed and can't wait the next version with all these new thrilling implementations, really

Edited by bublible

##### Share on other sites

Since it wasn't mentioned anywhere in the topic, and I'd like to know before downloading... does this work on Mac? POV-Ray doesn't, and I'd greatly appreciate the ability to do more professional renders of some of my LDD creations. So is this the program I've been waiting for, or should I keep looking?

##### Share on other sites

Well, tho I managed to get it working the results are for some reasons too dark (almost extremely) and I do not know why? Probably still doing something wrong...

WOW! Like, geee, not true anymore - taking my own words back : the result is - and I mean IS - simply brutal (with HDR lighting there is miracleously no too dar trans problem!), see compare these two images I just quickly made (the first is with standard "sunsky" light, the second with HDR file "Etnies_Park_Center"...ehm, OK, I know this is not HDR for SPACE but anyway, effect is enormeous after all )

##### Share on other sites

^ Nice render for 2nd one, bublible. How to use HDR lighting?

#1 & #2 Sunsky & spherical lights compare:

#3 & #4 Dark trans problem can also fix by make another render with trans part only, then phototshoped.

It seems like Bluerender can not render chrome part very well?

koensayr_y-pod L.lxf by Nachapon S., on Flickr

Capture 2 by Nachapon S., on Flickr

s30_fairladyz L.lxf by Nachapon S., on Flickr

21004 by Nachapon S., on Flickr

Edited by bbqqq

##### Share on other sites

^ Nice render for 2nd one, bublible. How to use HDR lighting?

Thanx tho they were just a quick renders to show the difference...

#3 & #4 Dark trans problem can also fix by make another render with trans part only, then phototshoped.

I know about that option but I would like to solve it in BlueRender itself without any other additional graphical "hokus-pokus" if you understand me...as this should be done straight away in the rendering tool/engine

BTW I think there is something wrong with the HDR image or the IBL light type cos the image seems not being right, looks like zoomed a lot to me, hm...

Edited by bublible

##### Share on other sites

How to use HDR lighting?

Sorry I didn't notice this question first time, so here it is (you can write this in whatever of those 3 .txt files but for msx80 usage we use the way he made it...therefore put this into Lights.txt or the Lights tab in BlueRender):

light
{
type ibl
# BEWARE: notice that for it to work you have to MANUALY CHANGE all "\" in the path to "/", also do not use any quotation
image Z:/somePath/myImage.hdr
# this moves your HDR image on x/y/z axes, changing it changes how/what part of the image actualy giving you the light
center 0 1 0
# do not change this part, just leave it as it is!
up 0 0 1
lock true
# the higher the samples the better lighting/shadows
samples 200
}


P.S.: if you put it in the Lights.txt file then it will be loaded everytime you run BlueRender, if you just put it in the Lights tab then it will be lost as soon as you close BlueRender.

##### Share on other sites

A couple more requests (apologies if they are repeats).

• Scale the rendering progress image to the size of the window so you can see the whole thing (or at least scale it if it's bigger than the current window size).
• During rendering, on the main screen display the percentage done, elapsed time, and expected remaining time. Even though it's fast it would be nice to know right away if something will take a long time because you might want to cancel it and change settings (right now I'm trying a higher resolution image and I have no idea how long it will take, and I can't even see the whole image in the progress window to guess).

##### Share on other sites

So now I've run into the "sun behind the model" problem, but I can't figure out how to change the sunsky options to move the light source. I'm a pretty smart programmer but everything I thought might work just made the image darker. The SunFlow documentation (such as it is) sheds no light and I don't want to invest in reading all the SunFlow code.

A workaround was alluded to earlier but no explanation was given. Can someone help me out?

##### Share on other sites

So now I've run into the "sun behind the model" problem, but I can't figure out how to change the sunsky options to move the light source. I'm a pretty smart programmer but everything I thought might work just made the image darker. The SunFlow documentation (such as it is) sheds no light and I don't want to invest in reading all the SunFlow code.

A workaround was alluded to earlier but no explanation was given. Can someone help me out?

in the lights file you have to change the following line:

sundir 1 1 1

you can put for example

sundir -1 1 -1

for the opposite direction (note the middle one is still 1, it's the up direction). It's a vector of where the sun is coming from.

I'll read the rest of the posts later :)

##### Share on other sites

So now I've run into the "sun behind the model" problem, but I can't figure out how to change the sunsky options to move the light source. I'm a pretty smart programmer but everything I thought might work just made the image darker. The SunFlow documentation (such as it is) sheds no light and I don't want to invest in reading all the SunFlow code.

A workaround was alluded to earlier but no explanation was given. Can someone help me out?

Could you post your render, just a preview to let us see what exactly you mean by that...?

Edited by bublible

##### Share on other sites

PROBLEM:

* IBL light (HDR image) - for some reason whatever I do I am still getting wrongly oriented HDR or at least I guess so.

Using "standard" settings for ibl positioning in SunFlow (according to one of the tut files) like:

...
center 0 -1 0
up 0 0 1
lock true
...


...but as you may see the picture seems to be wrong (and you can bet I really did try all possible combinations, even the absurd ones ):

HDR preview

ibl result

Edited by bublible

##### Share on other sites

Look like the up is wrong. It should be something like 0 1 0, i think (maybe the center has to change too?). Actually i know sunflow as much as you do (probably less by now :P) so i can't provide much help on it.

I think i'll release the new version today, it will have the following changes:

• remembers last used folder
• use a single scene.sc file instead of three files for setup, materials, lights
• scene files are not shown on the program anymore (was more confusion than anything)
• optional per-model scene file
• LDD decoration support
• custom decoration support

For custom scene file, it will use, if exists, a file named like the lxf but with sc extension. For example if you have spaceship.lxf, it'll search for spaceship.sc (in the same folder of course) and use that. For custom decors, the syntax is as follow, where the number is the decoration ID (not the part design id):

##CHANGEDECOR 59879 c:\path\to\custom\mydecor.png

Since it wasn't mentioned anywhere in the topic, and I'd like to know before downloading... does this work on Mac? POV-Ray doesn't, and I'd greatly appreciate the ability to do more professional renders of some of my LDD creations. So is this the program I've been waiting for, or should I keep looking?

As for blueprint, there's nothing that wouldn't work on Mac, but since i don't have one, i couldn't adjust all the small windows related issues and write the running scripts. If you want to try, i suggest waiting for 0002 as it will have more chance of working.

##### Share on other sites

I think i'll release the new version today, it will have the following changes:

• remembers last used folder
• use a single scene.sc file instead of three files for setup, materials, lights
• scene files are not shown on the program anymore (was more confusion than anything)
• optional per-model scene file
• LDD decoration support
• custom decoration support

For custom scene file, it will use, if exists, a file named like the lxf but with sc extension. For example if you have spaceship.lxf, it'll search for spaceship.sc (in the same folder of course) and use that. For custom decors, the syntax is as follow, where the number is the decoration ID (not the part design id):

##CHANGEDECOR 59879 c:\path\to\custom\mydecor.png

THAT IS ABSOLUTELY FANTASTIC - and I am even happier seeing my suggestions were any useful...and it is exactly as I would do it myself, simply perfect (you even applied the logic I intended to suggest regarding the .sc naming, super! ) - so now being as your mother I can clearly say: YOU ARE NOT GOOD, YOU ARE THE BEST! :laugh: :thumbup:

Look like the up is wrong. It should be something like 0 1 0, i think (maybe the center has to change too?). Actually i know sunflow as much as you do (probably less by now :P) so i can't provide much help on it.

I am affraid that is not the case as I really tried all thinkable options...

It looks more like there could be rotation option for the ibl light (could it be done programmatically?)

EDIT:

Oh, and one more thing: please, if you can, include also simple .log output of the imported .lxf bricks as we were speaking before, could you? Like it would make "spaceship.log" in the .lxf folder with every render (rewritten everytime without warning), you know similar to .pov output where one can search for the respective brick with all its attributes (colorID, decorationID, MATRIX etc...)

Edited by bublible

##### Share on other sites

you can put for example

sundir -1 1 -1

for the opposite direction (note the middle one is still 1, it's the up direction). It's a vector of where the sun is coming from.

Okay, thanks. I wasn't thinking straight. I figured it was probably a vector (although not knowing which axis was which), but I had incorrectly been thinking about ranges of [0, 1], rather than [-1, 1] which makes more sense. It was late so I'll use that as my excuse. ;)

Still, the only doc i could find on these parameters was a PDF compilation from an old wiki. Is there an actual reference somewhere for these parameters?

Another suggestion:

Every time you render, you reread and pre-process the LXF file. I suggest you cache the result in memory and reuse it if the LXF path and file timestamp has not changed. This will only save a handful of seconds today, but if you ever add additional pre-processing such as bevels or "LEGO" on the studs it will save a lot of time on re-renders. If you ever get that far, you could even switch to a persistent cache (possibly using ehcache?).

That was always something that annoyed me about POV-Ray!

Edited by iceleftd

##### Share on other sites

Okay, thanks. I wasn't thinking straight. I figured it was probably a vector (although not knowing which axis was which), but I had incorrectly been thinking about ranges of [0, 1], rather than [-1, 1] which makes more sense. It was late so I'll use that as my excuse. ;)

Still, the only doc i could find on these parameters was a PDF compilation from an old wiki. Is there an actual reference somewhere for these parameters?

Another suggestion:

Every time you render, you reread and pre-process the LXF file. I suggest you cache the result in memory and reuse it if the LXF path and file timestamp has not changed. This will only save a handful of seconds today, but if you ever add additional pre-processing such as bevels or "LEGO" on the studs it will save a lot of time on re-renders. If you ever get that far, you could even switch to a persistent cache (possibly using ehcache?).

That was always something that annoyed me about POV-Ray!

OK, here are some clues for you all:

light
{
# type of light used
type sunsky

# sun positioning on axes X Y Z
# 0 -1 0 = sun is literaly underground
# 0 0 0 = model sits on sun surface
# 0 1 0 = sun is above model in the sky (normal behavior)
up 0 1 0

# have not much clue actually, really
east 1 0 0

# placement of the sun ergo length and direction of the shadows and therefore also whole scene colorisation- like is it morning sun? evening sun? winter sun? summer sun?
sundir 1 1 1

# power of the sunshine: lower = more shadows and darker all around, higher = kind of (over)saturation effect
turbidity 4

# the more samples the more quality of shadows and the illumination itself
samples 32
}


##### Share on other sites

SUGGESTIONS:

* correct lights positioning - it should be positioned from BlueRay camera point-of-view, not from LDD original front side, cos then when you have your camera look lets say from behind and set your lights has to be "-10 0 0" then it actually move them in exact opposite direction to "10 0 0" cos it has locked its XYZ axes to front LDD view still which is wrong + of course not even saying they are not straight opposite values but it rather add some more degrees to it so it is in fact absolutely not possible to achieve quite simple lights placement as you may see I guess basically something similar you did with the camera transformation using %LDDCAMERA% but this time it should be upon actual BlueRender already transformed camera position where light "0 0 0" = transformed camera "0 0 0" position...and I think this one feature is the most important for now

* simple color gradient shader - allowing us having smooth color transition at least between two defined colors, that'd be great...and I know you can do it as you already proved your almost deity-like...or something

* rotation for IBL Lights - for correction of alignment of the HDR angle for such cases where simple "flipping" does not help

Edited by bublible

##### Share on other sites

it should be positioned from BlueRay

What is this new software ? :P :P

PS you can preview the release here, i'll update the page later... so much to do today :(