LDraw.org Discussion Forums
Which renderers support Texture Mapping - Printable Version

+- LDraw.org Discussion Forums (https://forums.ldraw.org)
+-- Forum: LDraw Programs (https://forums.ldraw.org/forum-7.html)
+--- Forum: LDraw Editors and Viewers (https://forums.ldraw.org/forum-11.html)
+--- Thread: Which renderers support Texture Mapping (/thread-22181.html)



Which renderers support Texture Mapping - Kevin Clague - 2017-05-31

Hi gang,
  Nice forums!  My complements to the folks who keep LDraw.org vibrant!

  Which renderers support texture mapping?
Thanks,
Kevin


RE: Which renderers support Texture Mapping - Travis Cobbs - 2017-05-31

(2017-05-31, 16:04)Kevin Clague Wrote:   Which renderers support texture mapping?

LDView (planar only) and LDCad (planar, cylindrical, and spherical, I think) support it. Not sure about others.


RE: Which renderers support Texture Mapping - Philippe Hurbain - 2017-05-31

(2017-05-31, 17:24)Travis Cobbs Wrote:
(2017-05-31, 16:04)Kevin Clague Wrote:   Which renderers support texture mapping?

LDView (planar only) and LDCad (planar, cylindrical, and spherical, I think) support it. Not sure about others.

Welcome here, Kevin!
Texmap is also supported by LeoCAD (don't remember if it supports cylindrical and spherical) and LDPartEditor.


RE: Which renderers support Texture Mapping - Kevin Clague - 2017-05-31

(2017-05-31, 18:01)Philippe Hurbain Wrote:
(2017-05-31, 17:24)Travis Cobbs Wrote: LDView (planar only) and LDCad (planar, cylindrical, and spherical, I think) support it. Not sure about others.

Welcome here, Kevin!
Texmap is also supported by LeoCAD (don't remember if it supports cylindrical and spherical) and LDPartEditor.

Hi Philo and Travis!

Thanks to all for the feedback.


RE: Which renderers support Texture Mapping - Jaco van der Molen - 2017-06-19

How does this work? Can I map an image to a brick?
I've never understood nor tried anything with texturemapping, but I have model with some custom prints and stickers.
Can it be used for that?


RE: Which renderers support Texture Mapping - Travis Cobbs - 2017-06-19

(2017-06-19, 13:08)Jaco van der Molen Wrote: How does this work? Can I map an image to a brick?
I've never understood nor tried anything with texturemapping, but I have model with some custom prints and stickers.
Can it be used for that?

It can certainly be used for custom prints and stickers, but was designed for use in official parts. The spec is here:

http://ldraw.org/documentation/ldraw-org-file-format-standards/language-extension-for-texture-mapping.html

Even a quick glance at the above will show that it's not designed for end users. Having said that, editors like LDCad could explicitly add support for creating a textured sticker. But that would be a new feature.

Also, if only one face of a part is visible in a model, a wrapper part could be created that texture maps that face. The problem is that the way the texture maps work, they would project all the way through the part. For real texture mapped parts, the texture mapping is limited in the part geometry to certain polygons, but that's not possible with a wrapper part.


RE: Which renderers support Texture Mapping - Travis Cobbs - 2017-06-19

Here is an example of what I mean by a wrapper part. Save the following DAT code in an ldr file:

Code:
0 !TEXMAP START PLANAR  -40 -20 -40  40 -20 -40  -40 60 -40  globe_west.png
1 1 0 0 0 1 0 0 0 1 0 0 0 1 3001.dat
0 !TEXMAP END

Save the following image in a file named globe_west.png in a textures subfolder of wherever you store the ldr file:

[Image: NsGaBYJ.png]

If you then load the file in a texmap-supporting renderer, you should get something like so:
[Image: 0zcHOQP.png]
[Image: S4NiigK.png]


RE: Which renderers support Texture Mapping - Travis Cobbs - 2017-06-19

And here is the code for a red sticker quad placed 1/2LDU in front of the same 2x4 brick:

Code:
0 !TEXMAP START PLANAR  -40 -20 -40  40 -20 -40  -40 60 -40  globe_west.png
4 4 -40 0 -20.5  40 0 -20.5  40 24 -20.5  -40 24 -20.5
0 !TEXMAP END
1 1 0 0 0 1 0 0 0 1 0 0 0 1 3001.dat

The above uses the same texture file, which needs to be stored in a textures subdirectory of wherever the ldr file is stored. The result looks like this:
[Image: Lo2VSjc.png]


RE: Which renderers support Texture Mapping - Roland Melkert - 2017-06-19

@jaco

fyi: anything with a texmap meta in it is considererd a part in LDCad so if you want to use it there you'll need to put the 'wrapper parts' in their own file (inside mpd).

If you want to generate (flat) stickers you can also use my online generator:
http://www.melkert.net/test/stickerGen.html


RE: Which renderers support Texture Mapping - Jaco van der Molen - 2017-06-19

Hmm, internesting.
I didn't gave this much thought, but could be interesting still.
Especially the second example Travis gave with the globe projected on one side of the brick.

Now I am designing this truck that has a 1x3x4 panel on the sides. I'd like to show a logo on that.
Can this be done using this technique?

Something like this:

[Image: s-l225.jpg]

(just an image I quickly found)


RE: Which renderers support Texture Mapping - Jaco van der Molen - 2017-06-19

(2017-06-19, 18:18)Travis Cobbs Wrote: And here is the code for a red sticker quad placed 1/2LDU in front of the same 2x4 brick:

Code:
0 !TEXMAP START PLANAR  -40 -20 -40  40 -20 -40  -40 60 -40  globe_west.png
4 4 -40 0 -20.5  40 0 -20.5  40 24 -20.5  -40 24 -20.5
0 !TEXMAP END
1 1 0 0 0 1 0 0 0 1 0 0 0 1 3001.dat

The result looks like this on my Mac with LDView:

   



RE: Which renderers support Texture Mapping - Travis Cobbs - 2017-06-19

Did you store the image as textures/globe_west.png, where the textures directory is alongside texture.dat? And do you have "Use texture maps" enabled in the Primitives tab of LDView's preferences?


RE: Which renderers support Texture Mapping - Travis Cobbs - 2017-06-19

(2017-06-19, 19:37)Jaco van der Molen Wrote: Hmm, internesting.
I didn't gave this much thought, but could be interesting still.
Especially the second example Travis gave with the globe projected on one side of the brick.

Now I am designing this truck that has a 1x3x4 panel on the sides. I'd like to show a logo on that.
Can this be done using this technique?

Something like this:

[Image: s-l225.jpg]

(just an image I quickly found)

Use Roland's stickergen web page to generate the sticker ldr file. While it says that the aspect ratio of the quad has to match the aspect ratio of the image, that's not really true. Just be aware that the whole image will be mapped to the rectangle. Textures are often best with power-of-two dimentions (like 128x256, for example). Since the aspect ratio of the above sticker is close to square, but not quite, you can squeeze the image in the long dimension until it is square, and map that to a rectangle with the same aspect ratio as the original un-squeezed image, and everything should work out.


RE: Which renderers support Texture Mapping - Jaco van der Molen - 2017-06-20

(2017-06-19, 20:59)Travis Cobbs Wrote: Did you store the image as textures/globe_west.png, where the textures directory is alongside texture.dat? And do you have "Use texture maps" enabled in the Primitives tab of LDView's preferences?

Ah, OK. The image was in the right folder, but the preferences were disabled. This works!

Now for LPub3D: when I use LDView as renderer, the texture is not rendered. How to achieve this?

That would be the whole point for me to be able to generate instructions with textures (custom printing) applied.


RE: Which renderers support Texture Mapping - Travis Cobbs - 2017-06-20

(2017-06-20, 6:43)Jaco van der Molen Wrote:
(2017-06-19, 20:59)Travis Cobbs Wrote: Did you store the image as textures/globe_west.png, where the textures directory is alongside texture.dat? And do you have "Use texture maps" enabled in the Primitives tab of LDView's preferences?

Ah, OK. The image was in the right folder, but the preferences were disabled. This works!

Now for LPub3D: when I use LDView as renderer, the texture is not rendered. How to achieve this?

That would be the whole point for me to be able to generate instructions with textures (custom printing) applied.

Try copying the texture image to <LDraw>/Unofficial/parts/textures. I think LPub (and LPub3D) create new files in a different directory for rendering, and that process probably doesn't copy the associated texture images. (<LDraw>/models/textures might work also, and would probably be more appropriate if it does work.)


RE: Which renderers support Texture Mapping - Merlijn Wissink - 2017-06-20

LPub3D creates a directory called LPub3D in the same folder as the LDraw file that's being worked on. In there it stores all submodels separately (for rendering), the generated images and maybe some more stuff (can't remember out the top of my head). It also uses separate parts libraries (don't ask me why...) for official and unofficial parts. Those libraries are located somewhere in the AppData folder.


RE: Which renderers support Texture Mapping - Jaco van der Molen - 2017-06-20

(2017-06-20, 18:36)Merlijn Wissink Wrote: LPub3D creates a directory called LPub3D in the same folder as the LDraw file that's being worked on. In there it stores all submodels separately (for rendering), the generated images and maybe some more stuff (can't remember out the top of my head). It also uses separate parts libraries (don't ask me why...) for official and unofficial parts. Those libraries are located somewhere in the AppData folder.

OK, tried a bunch of different places to put the textures folder containing the image.

Alas, the LDraw file LPub3D makes takes out the lines for the texture:

Code:
4 4 -40 0 -20.5  40 0 -20.5  40 24 -20.5  -40 24 -20.5
1 1 0 0 0 1 0 0 0 1 0 0 0 1 3001.dat

Instead of


Code:
0 !TEXMAP START PLANAR  -40 -20 -40  40 -20 -40  -40 60 -40  globe_west.png
4 4 -40 0 -20.5  40 0 -20.5  40 24 -20.5  -40 24 -20.5
0 !TEXMAP END
1 1 0 0 0 1 0 0 0 1 0 0 0 1 3001.dat

So basically the file LPub3D uses to render the images for the instructions are without the TEXMAP meta and no texture is rendered... :-(

Any more ideas? I thing LPub3D needs some recoding regarding the TEXMAP meta.
And I haven't seen Trevor posting for a while, so I think regarding texture mapping we are on a dead end when it comes to LPub3D.


RE: Which renderers support Texture Mapping - Roland Melkert - 2017-06-20

(2017-06-20, 19:06)Jaco van der Molen Wrote: So basically the file LPub3D uses to render the images for the instructions are without the TEXMAP meta and no texture is rendered... :-(

Any more ideas? I thing LPub3D needs some recoding regarding the TEXMAP meta.
And I haven't seen Trevor posting for a while, so I think regarding texture mapping we are on a dead end when it comes to LPub3D.

Maybe if you put the texmapped parts in separate files you can copy them over the generated ones once lpub is done generating. Or make them readonly so lpub can't overwrite them by placing them in the cache location before lpub generates them (might trigger an error though).

Or place the textured .dat's in wherever lpub get its 'official' part from.


RE: Which renderers support Texture Mapping - Travis Cobbs - 2017-06-20

What if you put the texture mapped quad in its own file, give it an unofficial part header, and stick it in the <LDraw>/Unofficial/parts directory? Put the texture in <LDraw>/Unofficial/parts/textures.


Code:
0 Jaco's Super-Awesome Sticker
0 Name: sticker.dat
0 Author: Jaco van der Molen
0 !LDRAW_ORG Unofficial_Part

0 !TEXMAP START PLANAR  -40 -20 -40  40 -20 -40  -40 60 -40  globe_west.png
4 4 -40 0 -20.5  40 0 -20.5  40 24 -20.5  -40 24 -20.5
0 !TEXMAP END

Hopefully LPub3D isn't modifying official or unofficial parts.


RE: Which renderers support Texture Mapping - Jaco van der Molen - 2017-06-21

(2017-06-20, 21:03)Travis Cobbs Wrote: What if you put the texture mapped quad in its own file, give it an unofficial part header, and stick it in the <LDraw>/Unofficial/parts directory? Put the texture in <LDraw>/Unofficial/parts/textures.


Code:
0 Jaco's Super-Awesome Sticker
0 Name: sticker.dat
0 Author: Jaco van der Molen
0 !LDRAW_ORG Unofficial_Part

0 !TEXMAP START PLANAR  -40 -20 -40  40 -20 -40  -40 60 -40  globe_west.png
4 4 -40 0 -20.5  40 0 -20.5  40 24 -20.5  -40 24 -20.5
0 !TEXMAP END

Hopefully LPub3D isn't modifying official or unofficial parts.

YES! That's it, Travis!

Now for the next challenge: how to get it right in the PLI?
I'd like the "printed" part in there as printed too.

I guess I have to make a complete unofficial part with texture applied for that.
Back to the drawing board...


RE: Which renderers support Texture Mapping - Merlijn Wissink - 2017-06-21

If a part is not showing (correctly) in the PLI, you have to add it to LPub3D's own library located in C:\Users\[Username]\AppData\Local\LPub3D Software\LPub3D\libraries.
There are 2 zip files there, the official library and an unofficial library. Just add your new parts to lpub3dldrawunf.zip and it should appear in the PLI.


RE: Which renderers support Texture Mapping - Jaco van der Molen - 2017-06-21

(2017-06-21, 6:38)Merlijn Wissink Wrote: If a part is not showing (correctly) in the PLI, you have to add it to LPub3D's own library located in C:\Users\[Username]\AppData\Local\LPub3D Software\LPub3D\libraries.
There are 2 zip files there, the official library and an unofficial library. Just add your new parts to lpub3dldrawunf.zip and it should appear in the PLI.

Yes, I know Merlijn. I do this all the time with unofficial parts ;-)
I made a part "globe.dat" and put it in all places I could think of, including the folder "textures" with the image.
The part globe.dat is in there, but LPub3D logs say otherwise:


Code:
NOTICE void LDrawFile::countParts(const QString&) @ln 1014 "Item [globe.dat] not in the LPub3D archives. C:/Documents and Settings/mj/Local Settings/Application Data/LPub3D Software/LPub3D/libraries/lpub3dldrawunf.zip C:/Documents and Settings/mj/Local Settings/Application Data/LPub3D Software/LPub3D/libraries/complete.zip"
STATUS void Gui::statusMessage(bool, QString) @ln 625 "LDR model file texturetest.ldr loaded. Count 0 parts"

The CSI renders fine, but no content in the PLI :-(


RE: Which renderers support Texture Mapping - Jaco van der Molen - 2017-06-21

EUREKA!

I got things to work and have a result I was looking for.
It turned out my old Windows XP (yes I know) machine was somehow misconfigured and unable to do what I want.

But my new Windows 7 machine did it!

I´ll post my findings and workflow in a moment.


RE: Which renderers support Texture Mapping - Jaco van der Molen - 2017-06-21

[quote pid='25511' dateline='1498031642']
 Findings and workflow:
[/quote]

  1. Create a part "globe".dat" and put it in C:\Users\Public\Documents\LDraw\Unofficial\Parts
  2. Create a folder "textures" in C:\Users\Public\Documents\LDraw\Unofficial\Parts and put the PNG image in there
  3. Make a model file using the part "globe.dat"
  4. Make sure in LDView 4.2 that settings/preferences "Primitives > Textures > Use texture maps" is checked (and test if the model renders correctly with texture applied)
  5. Find out what the folder of the zipped libraries LPub3D is. On my new machine it is "C:\Users\mj\AppData\Local\LPub3D Software\LPub3D"
  6. Copy the "globe.dat" and folder "textures" in C:\Users\Public\Documents\LDraw\Unofficial\Parts
  7. Using the file explorer (of any zip program) paste (or add) dat file and textures folder to lpub3dldrawunf.zip\parts
  8. Start LPub3D and make sure your renderer is LDView
  9. Load your LDraw file in LPub3D and see if it renders the part with texture applied in both PLI and CSI
If you follow these steps, it should work... I think.

I have to do some testing with my model and actual print, but things look hopefull.
Just need to figure out how to apply the texture and what size of PNG image to use, etc....

To all who read and replied (special thanks to Roland, Travis and Merlijn) and thought with me: many thanks!

I will write more findings and show result later.
And if I find time I'll write a tutorial for my website :-)


RE: Which renderers support Texture Mapping - Jaco van der Molen - 2017-06-22

I am so content I got things working with texture mapping!

I have succesfully created all the stickers and custom printed/patterned parts for my needs now.

To all who have contributed to this thread: again thank you.

And ofcourse thanks for LDCad en LDView supporting it ;-)


RE: Which renderers support Texture Mapping - Michael Horvath - 2017-12-20

I created a new file "New Project.ldr" and set its contents to this:


Code:
0 !TEXMAP START PLANAR 256 10 256 256 10 -256 -256 10 256 intersection_left_01.png
4 16 256 1 -256 256 1 256 -256 1 256 -256 1 -256
0 !TEXMAP END

However, in LDview I only see a blank rectangle. I have attached the PNG file.

   

Both files are in the same directory. What am I doing wrong? Thanks!

[edit]

Never mind. I had turned off texture mapping in LDView settings by mistake. I turned it on and it works now.


RE: Which renderers support Texture Mapping - Bill Ward - 2018-06-10

(2017-06-21, 8:12)Jaco van der Molen Wrote: [quote pid='25511' dateline='1498031642']
 Findings and workflow:

  1. Create a part "globe".dat" and put it in C:\Users\Public\Documents\LDraw\Unofficial\Parts
  2. Create a folder "textures" in C:\Users\Public\Documents\LDraw\Unofficial\Parts and put the PNG image in there
  3. Make a model file using the part "globe.dat"
  4. Make sure in LDView 4.2 that settings/preferences "Primitives > Textures > Use texture maps" is checked (and test if the model renders correctly with texture applied)
  5. Find out what the folder of the zipped libraries LPub3D is. On my new machine it is "C:\Users\mj\AppData\Local\LPub3D Software\LPub3D"
  6. Copy the "globe.dat" and folder "textures" in C:\Users\Public\Documents\LDraw\Unofficial\Parts
  7. Using the file explorer (of any zip program) paste (or add) dat file and textures folder to lpub3dldrawunf.zip\parts
  8. Start LPub3D and make sure your renderer is LDView
  9. Load your LDraw file in LPub3D and see if it renders the part with texture applied in both PLI and CSI
If you follow these steps, it should work... I think.

I have to do some testing with my model and actual print, but things look hopefull.
Just need to figure out how to apply the texture and what size of PNG image to use, etc....

To all who read and replied (special thanks to Roland, Travis and Merlijn) and thought with me: many thanks!

I will write more findings and show result later.
And if I find time I'll write a tutorial for my website :-)
[/quote]

I've been having a similar difficulty, and following your steps fixed my problem. Only I'm using a Mac, so the location is:
/Applications/LPub3D.app/Contents/Resources/lpub3dldrawunf.zip