Pedrollane Posted August 21, 2015 Posted August 21, 2015 (edited) I wrote a Java application to convert an LDraw model to Sunflow. Thank you to msx80 for giving me the idea with Blurender Thank Bublible I use some of your metallics materials in my application. It is not complete yet but I have tested on several models without problems. There are still things to optimize and probably bugs. Currently no progress bar, keep an eye on the console to see the progress of the work. Screenshot: Only the "render" button not "ipr" saves the image in the same directory as the stage Sunflow. (not true with the latest version) In the LDraw tab you can set : - LDraw path - Common used texterea is a solution to optimize the final mesh Examples : These models comes from here 3063 - Heartlake Flying Club 30210 - Frodo with cooking corner 30210 - Frodo with cooking corner Download : Version e - here Version d - here Version c - here Version b - here Version a - here Edited September 24, 2015 by Pedrollane Quote
___ Posted August 21, 2015 Posted August 21, 2015 Looks very promising indeed! Will test it later... + I am happy you like my work with those special materials and that you actually used them. ;-) Quote
Dilvish Posted August 23, 2015 Posted August 23, 2015 Can't wait to see how this project progresses! Quote
Philo Posted August 24, 2015 Posted August 24, 2015 Interesting project, rendered two models flawlessly! Quote
Pedrollane Posted August 24, 2015 Author Posted August 24, 2015 I fixed a bug on the pattern display. Before After You can download the new version here Quote
___ Posted August 24, 2015 Posted August 24, 2015 I fixed a bug on the pattern display. Before After You can download the new version here So now it also supports decorations, that is great! Quote
reilar Posted August 24, 2015 Posted August 24, 2015 (edited) Hi, I'm trying to use your tool. Does it require any other applications installed (like Sunflow)? I'm asking because i get this error: ... aug 24, 2015 3:26:58 EM com.sunflow.converter.ldrawtosunflow.LdrawConverterMulti2 parseFile SEVERE: Erreur sur la ligne 0.0 -4.0 0.0 aug 24, 2015 3:26:58 EM com.sunflow.converter.ldrawtosunflow.LdrawConverterMulti2 parseFile SEVERE: Erreur sur la ligne triangles 144 Exception in thread "AWT-EventQueue-0" java.util.NoSuchElementException at java.util.StringTokenizer.nextToken(Unknown Source) at com.sunflow.converter.ldrawtosunflow.LdrawConverterMulti2.parseFile(LdrawConverterMulti2.java:259) at com.sunflow.converter.ldrawtosunflow.LdrawConverterMulti2.<init>(LdrawConverterMulti2.java:75) ... I'm running on Win 10 with the LDraw path pointed on the directory that is used by e.g. LDCad. Edited August 24, 2015 by reilar Quote
Pedrollane Posted August 24, 2015 Author Posted August 24, 2015 (edited) No need more jar, all is in the package. Can you send me the file ? Edited August 24, 2015 by Pedrollane Quote
reilar Posted August 24, 2015 Posted August 24, 2015 Sorry, I don't know how to send you the file. Doesn't seem that I'm allowed to PM you yet. I probably need to write more in the forums:) ...but when I start the application it looks like this in the cmd window: C:\Users\Reine\Downloads\LDraw2Sunflow_b>java -jar Ldraw2Sunflow.jar aug 24, 2015 4:07:56 EM java.util.prefs.WindowsPreferences <init> WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5. aug 24, 2015 4:07:56 EM org.ldrawtosunflow.ui.Ldraw2Sunflow <init> INFO: en_GB Could it be a problem with localization? Quote
Dilvish Posted August 24, 2015 Posted August 24, 2015 (edited) Will this support Darats' High quality STL files? http://www.eurobricks.com/forum/index.php?showtopic=108739 (I have trouble keeping track of all the different parts libraries.) Edited August 24, 2015 by Dilvish Quote
Pedrollane Posted August 24, 2015 Author Posted August 24, 2015 C:\Users\Reine\Downloads\LDraw2Sunflow_b>java -jar Ldraw2Sunflow.jar aug 24, 2015 4:07:56 EM java.util.prefs.WindowsPreferences <init> WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5. You can solve this warning : Go into your Start Menu and type regedit into the search field. Navigate to path HKEY_LOCAL_MACHINE\Software\JavaSoft Right click on the JavaSoft folder and click on New -> Key Name the new Key Prefs and everything should work. Direct link to solution aug 24, 2015 3:26:58 EM com.sunflow.converter.ldrawtosunflow.LdrawConverterMulti2 parseFile SEVERE: Erreur sur la ligne 0.0 -4.0 0.0 aug 24, 2015 3:26:58 EM com.sunflow.converter.ldrawtosunflow.LdrawConverterMulti2 parseFile SEVERE: Erreur sur la ligne triangles 144 For this error, without the file difficult to find Quote
Pedrollane Posted September 1, 2015 Author Posted September 1, 2015 I have update Ldraw2Sunflow : When the scene is generated a 3D preview appears, for smaller models. large models only the bounding box appears because I have memory problems.You can use the mouse to turn around the model and the direction arrows to move the camera. When you press ESC or close the window, the last position of the camera is used to generate the Sunflow scene. IPR and Render buttons save the image ldraw official and unofficial parts can be in separate directory. I'm working on Darats' High quality STL files support, for the next version. Examples : Space / Ice Planet 2002 / 6983 - Ice Station Odyssey 42039 - 24 Hours Race Car / Technic Quote
SylvainLS Posted September 1, 2015 Posted September 1, 2015 Hi, just a few notes from my experience trying LDraw2Sunflow on Linux: First, there’s a '\' used as a file separator in PartFinder.checkLDrawDirectory(). '\' is a normal character in POSIX filesystems. That’s not portable. Next, LDraw is (almost) case-insensitive for filenames. An LDR file can refer to parts in lowercase, uppercase, or mixedcase (not necessarily the actual case on the filesystem). The LDraw official parts archive has all its parts filenames in lowercase but some parts refer to others in uppercase (or, some, only with an uppercase .DAT). E..g. “p/8/stud6.dat” refers to “3-4edge.DAT” and “p/znap1.dat” refers to “1-4EDGE.DAT”. The files in the archive are “3-4edge.dat” and “1-4edge.dat”. That’s important because POSIX filesystems are actually case-sentive (not the compatible-with-DOS-but-allowing-pretty-case of Windows filesystems). Finally, does the GSLS version really need to be 1.50? I tried 130 and it seemed to work. (The driver, Mesa, advertises 1.30 for GSLS even if its “core profile” (whatever that means) GSLS is 3.30. So 1.50 is too high for me.) Quote
Pedrollane Posted September 1, 2015 Author Posted September 1, 2015 Thank for your feedback SylvainLS I removed the backslash in PartFinder.checkLDrawDirectory() and check other class it seems ok. Now i'm look for parts in lowercase. Shader version don't need to be 150. I have start with version 330 but is too high for my netbook I change to 150. Now I change to 130 I have find the memory leak on preview OpenGL it work now, there are no more big ugly gray and blue box You can find the last version here Quote
SylvainLS Posted September 1, 2015 Posted September 1, 2015 Thank for your feedback SylvainLS No problem… at least for me Now i'm look for parts in lowercase. Er, that’s not quite right yet. The LDraw library .dat files and directories are in lowercase, the other LDraw files are mixedcase (e.g. LDConfig.ldr) and, above all, other files and directories on the filesystem are mixedcase/case-sensitive. So, always using toLowerCase on the complete path is not an option. Only the relative path to the LDraw library files should be lowercased (“p”, “parts” and “models” included but not the prefix). The filepath to the main model, the file to convert, should not be lowercased. It’s quite a bother, eh? In fact, I checked LDView’s code (but other programs should be similar): LDView first look for the all-lowercase filename, then all-uppercase, then the original filename. Shader version don't need to be 150. I have start with version 330 but is too high for my netbook I change to 150. Now I change to 130 I have find the memory leak on preview OpenGL it work now, there are no more big ugly gray and blue box You can find the last version here Great! Quote
SylvainLS Posted September 1, 2015 Posted September 1, 2015 Me again! A few little itches with the OpenGL preview: 1. The aspect ratio doesn’t match the render, so it’s difficult to correctly prepare the view. 2. Is there a way to change the center (or shift the model / pan the view)? 3. It’s certainly a matter of taste but the mouse controls are reversed in regard to others 3D viewers I’m used to (Leocad, LDView and LDD among them ). I’m used to the “drag the model” metaphor, not the “move the camera” one. Also, OpenGL preview is okay (the colors are a bit off: light bley looks lavender-ish) but I get “GRAVE: Shader compile error :” (no more info on the line). Quote
Darats Posted September 1, 2015 Posted September 1, 2015 I'm working on Darats' High quality STL files support, for the next version. Really nice renders. I would like to know how you can implement support for my LGEO parts library. As it is Povray code, using many boolean operations, especially for patterned parts, I don't really understand how you can do that. Same for studs, how can you do that. Then, I'm currently rewriting the entire library using "mesh2" povray meshes instead of "mesh" ones. It's a very long process and I can't tell when it will be over, but I'm regularly updating the package (without notification). This is transparent for PovRay users but it might give you issues if your writing some compatibility code. Maybe we could get in touch to talk about it. Quote
___ Posted September 2, 2015 Posted September 2, 2015 (edited) I have question about the SunFlow part: what version of SF did you used? Cos version 0.72 has problems with glasses being too dark - if you managed to solve it can you tell us how? I am asking because another project using SF named BlueRender for LDD using modified v0.72 suffer from that problem whereas your renders seem to have their glasses OK (although I managed to solved it partly). BTW render of #6973 looks fantastic to me, almost real! Edited September 2, 2015 by bublible Quote
Pedrollane Posted September 2, 2015 Author Posted September 2, 2015 I used a modified version of Bluerender Sunflow version. I have checkout this version : https://bitbucket.or...8967?at=default I made changes in some classes : BoundingIntervalHierarchy ->I've change a 2 lines in subdivide function because of infinite loop some times. SCParser -> I added a noinstance=true where type equals generic-mesh Instance -> I removed return false when matrice determinant is null. AccelerationStructureFactory -> I used UniformGrid in place of BoundingIntervalHierarchy when primitive is null. Quote
___ Posted September 2, 2015 Posted September 2, 2015 (edited) I used a modified version of Bluerender Sunflow version. I have checkout this version : https://bitbucket.or...8967?at=default I made changes in some classes : BoundingIntervalHierarchy ->I've change a 2 lines in subdivide function because of infinite loop some times. SCParser -> I added a noinstance=true where type equals generic-mesh Instance -> I removed return false when matrice determinant is null. AccelerationStructureFactory -> I used UniformGrid in place of BoundingIntervalHierarchy when primitive is null. So it means you are basically using "our" SF version for BlueRender, hm, interesting - could you, please, provide your modified src/final sunflow.jar for SF so I can test it here to see if your changes have any significance to the glass problem? Edited September 2, 2015 by bublible Quote
Pedrollane Posted September 2, 2015 Author Posted September 2, 2015 The sunflow modified sources are here Quote
___ Posted September 2, 2015 Posted September 2, 2015 The sunflow modified sources are here Thanx a lot - I will test it later today and then let you know what was the result of it. Quote
Pedrollane Posted September 2, 2015 Author Posted September 2, 2015 Two pictures First without Darats parts : Second with Darats parts (and no binoculars I don't know where they are) : Look arms, hands, shovel, motor grid. it's not yet available but soon Quote
___ Posted September 2, 2015 Posted September 2, 2015 (edited) Thanx a lot - I will test it later today and then let you know what was the result of it. TESTED - unfortunately there is no advantage/improvement in glass rendering over original BlueRender's version...I used latest BR v0.004 with replaced sunflow.jar (with the one built from your SF src you provided above) and the final result - used with BR - is really bad (you probably changed some stuff that is badly needed by BlueRender I guess) - msx80's Orca model a little bit MODded by me : This is result from your SF: This one is ORIGINAL BlueRender's materials & SF (v0.004) ...and finally this one is result of my own materials & SF MOD: So as you can see glass material is basically the same quality with your and original BR SF although when I saw your #6973 render I thought it is much more improved over the original one (maybe there is something else in your other src code elsewhere?), but as of now my MOD is the way to go at least deffinitely for me cos compared to original one it looks really like a plastic trans glass wheres the original is too dark and dull. Anyway thank you for your kindness providing your src for testing - appriciated! Edited September 2, 2015 by bublible Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.