LDraw.org Discussion Forums
Fast Photoreal Rendering +++ UPDATE +++ - Printable Version

+- LDraw.org Discussion Forums (https://forums.ldraw.org)
+-- Forum: LDraw Programs (https://forums.ldraw.org/forum-7.html)
+--- Forum: Rendering Techniques (https://forums.ldraw.org/forum-20.html)
+--- Thread: Fast Photoreal Rendering +++ UPDATE +++ (/thread-12928.html)

Pages: 1 2 3


Re: Fast Photoreal Rendering - Travis Cobbs - 2014-05-02

virtualrepublic Wrote:And another test with a Technic model. Unfortunately MLCad reports missing parts.

[Image: 8070_Technic_Car_v03.jpg]

FYI, I wrote a program 10+ years ago that processes an LDraw file and unmirrors subsections so that studs wouldn't have mirrored stud logos. If you're interested, let me know if you're on a PC or Mac, and I'll try to build it. (I might not succeed, since it uses my LDraw file loading code from LDView, and that code has changed a LOT in 10+ years.)


Re: Fast Photoreal Rendering - Travis Cobbs - 2014-05-02

I tracked down the binary I posted all those years ago, and re-uploaded it to a working location.

Below is my post from LUGNet when I first wrote UnMirrorStuds, but with an updated URL. Note that I never did go back and work on it, because as far as I can tell, nobody used it. The version posted below is a 32-bit Windows command line program. It's not incredibly likely that I'll ever update the program, but its source code has been in the LDView CVS repository on SourceForge for a very long time.

Travis Cobbs Wrote:OK, I have created a command line program to un-mirror studs. It is called
UnMirrorStuds, and version 0.1 is available from the following location:

http://www.halibut.com/~tcobbs/ldraw/private/UnMirrorStuds01.zip

Please download it and give it a try, and let me know what you think. I'd like
to have people process as many files as possible in order to track down and fix
any errors. Please note that I haven't personally tested the output with L3P; I
just commented out the automatic stud mirroring in LDView and used that to proof
the output. It works on all the files I have tested it against (including files
with large mirrored sub-assemblies for wings and such).

If it finds any mirrored studs in a model, it creates a new model with a .ums
(un-mirror studs) extension. Send this new model to L3P with stud logos turned
on, and the resulting POV file shouldn't contain any mirrored stud logos.
(Rendering the POV file should produce an image with no mirrored logos.)

In order to handle all possible stud mirroring scenarios, it creates files with
.ums and .um2 extensions where necessary all the way along the model heirarchy
(including in the parts directory). There is also an option to delete all the
files created for a particular file.

If you run it with no command line arguments, it will give you a list of
options. If it creates a new file, it will tell you the filename (your old
filename with its extension replaced with .ums). If you run it on a file with a
.ums extension, that file will be replaced if any mirrored studs are detected
(which admitedly won't happen if the file was generated by the program, and
there is a -s option which prevents the replacement of any files). It doesn't
currently support MPD files, but does detect them; if you give it one, it will
give you an error.

I will release the source code at some point, but it is using my new LDraw model
loading code under development for the next major LDView release, and that code
isn't ready for prime-time. If anyone has a pressing interest, send me an
e-mail, and I will send it to you. As an aside, if you run UnMirrorStuds with
the -v (verbose) option, you will see all the errors and warnings generated by
my new code (some of which will go away prior to an LDView release using the
code).

Once I am convinced that the program is fairly stable (either as-is or--more
likely--after modifications from feedback here), I will post it to
lugnet.anounce and send the program to ldraw.org. While it should work fine, I
wouldn't recommend using it if you are new to LDraw (but then, if you are,
you're probably not reading this newsgroup).



Re: Fast Photoreal Rendering - Michael Klein - 2014-05-02

Good morning,

thanks for the info and time. I will check this out asap.

Michael


Re: Fast Photoreal Rendering - Michael Klein - 2014-05-02

Hi,

it generates the file in inside the file the parts with the wrong studs are also named with .ums extension and this can't be converted of course. When I rename the parts with .DAT it will give me again the mirrored studs in Blender.


Re: Fast Photoreal Rendering - Damien Roux - 2014-05-02

Maybe the Blender importer doesn't take all Ldraw command into account (especially the one that tell the stud not to be mirrored).


Re: Fast Photoreal Rendering - Michael Klein - 2014-05-02

Yes, it looks like. In MLCad my modified studs looks now correct but the LDR Blender script will still load the mirrored ones.


Re: Fast Photoreal Rendering - Travis Cobbs - 2014-05-02

I'm not sure what you mean by "can't be converted of course." Does the Blender script reject loading files with other extensions? Because if so, I would say that's a bug. Or does it use parts.lst and only support library files that are in there? Or is something else going on?

The .ums files that UnMirrorStuds creates are standard LDraw files. And the .ums version of the model itself references these files. (If the model has sub-models, .ums versions of those are created if needed, referencing .ums files where appropriate. I don't remember off-hand what the .um2 files are. I think they're for mirrored sub-models that themselves contain both mirrored and non-mirrored studs.) I suppose the UnMirrorStuds program could be updated to append -ums to the base filename instead of changing the extension to .ums if the extension really is causing problems, but I don't understand why that would be the case.


Re: Fast Photoreal Rendering - Travis Cobbs - 2014-05-02

There's no special command. IIRC, it simply replaces the stud.dat reference with a stud.ums reference for studs that have been detected as being mirrored. The stud.ums file has a matrix that mirrors the stud a second time, which results in a correct stud logo. Since the stud is symmetric with the exception of the logo, this second mirroring doesn't cause problems.


Re: Fast Photoreal Rendering - Michael Klein - 2014-05-02

+++ UPDATE +++

I found the reason: I must start the cmd in Admin mode otherwise no .ums files will be generated.

//

Hi,

when I execute "unmirrorstuds.exe 8070.ldr" is will generate a file called "8070.ums". In this ".ldr" file the mirrored pieces are named with the extension ".ums". Where are those models now? Because this file can't be converted or properly opened in MLCad because the parts with .ums extension are unknown of course.


Re: Fast Photoreal Rendering - Travis Cobbs - 2014-05-02

The UnMirrorStuds.exe program generates stud-mirrored copies of the official parts alongside those official parts (in your LDraw directory). If you look there, you should see various .ums (and possibly .um2) files. And the .ums version of your original model generated by running the program should open in MLCad without any problem. I just tested with a relatively simple model (which only generated two .ums files in my LDraw parts directory, plus one .um2 in parts/s). MLCad opened the file without any errors. I did have to enter *.ums into the file name field of the file open dialog and hit enter in order to see the main file.

Note: to get rid of all of the *.ums and *.um2 files that UnMirrorStuds creates in the LDraw parts directories, run UnMirrorStuds with the -d option, and give it your original LDraw file. It will delete the .ums version of your LDraw file, plus all other .ums/.um2 files that it created when you ran it the first time.

The fact that the files have a different extension makes no difference to MLCad or LDView with respect to viewing the file. (I wouldn't advise trying to edit a .ums file in MLCad, though.) It shouldn't make any difference to other programs either, but I can't be 100% sure of that.

If you're willing to send me your LDraw file, I'll test it myself, but I don't see why it should behave differently in MLCad from the file I ran. Send the file to the LDView email address.