leozide / leocad

A CAD application for creating virtual LEGO models
https://www.leocad.org
2.46k stars 208 forks source link

Reference Images #45

Closed emanuele3d closed 7 years ago

emanuele3d commented 7 years ago

Hi @leozide, newbie user here.

In the Visual Effects industry it is typical to make 3D models out of reference images, which could be photos, blueprints or even concept art. We do this by adding to the 3d scene one or more orthogonal planes with the reference images mapped onto them. See an example here.

I haven't found a way to do this in LeoCAD, can you confirm? If so, can you add it to the wishlist? It would be very beneficial for scale builds.

Obviously the best way from a performance perspective would be to do it with simple quads with a texture mapped onto it, like it is done in the example video. But perhaps you might want to catch two pigeons with one stone and implement the functionality to add arbitrary "stickers" to groups of bricks. In that scenario we'd simply add one or more images to one or more large smooth plates or even to a wall of bricks.

What do you think?

leozide commented 7 years ago

There isn't any way to do that right now, there used to be a way to set a texture on the base plane and I experimented with having vertical grids similar to what you're asking (but without the textures).

emanuele3d commented 7 years ago

And what was the outcome of the experiment and why did you eventually remove the way to have a texture on the base plane?

leozide commented 7 years ago

I didn't think the vertical grid was helping with the placement of pieces during my tests so I never checked it in.

The base plane was probably removed when I removed the terrain support. I saw it as a publishing feature and I wanted to focus on instructions more.

Here's an old screenshot of what it looked like:

image

emanuele3d commented 7 years ago

I see what you mean. Even if I was building a larger model I'd use large plates as grounds rather than a generic plane with a texture.

So you had vertical, axis-aligned grids? I.e. along the XY and ZY planes (assuming Y is up)? With spacing between lines matching a 1x1 brick? When I worked in VFX and done other 3D work axis-aligned grids were useful, but I wasn't dealing with discrete objects like bricks and snapping to the (highly customizable) grids was quite useful, especially if the snapping could be quickly turned on/off.

But I can see how with Lego bricks they might be more redundant: all you need is a big plate to snap your bricks to.

How about resurrecting that code adding the functionality to have a texture-mapped plane under the (infinite?) grid? What would be important is that the plane can be resized independently, so that, say, somebody using blueprints to model a car can choose between creating a modest 9-stud-wide model or, say, a much more complex 13-stud-side model.

leozide commented 7 years ago

I've written an example on how to get this to work:

http://www.leocad.org/docs/texmap.html

emanuele3d commented 7 years ago

Thank you @leozide : I will give it a try.

DLu commented 6 years ago

I have two questions about the referenced example. First, where does that code go? Secondly, what folder would you put the images in? All of the configurations I've tried thus far have resulted in segmentation faults.

leozide commented 6 years ago

You have to open the ldr file with a text editor and paste it there.

Images should go in parts/textures. How did you get a segfault?

DLu commented 6 years ago

Using LeoCAD-Linux-18.02-x86_64.AppImage, I put the referenced code by itself in a textfile. I don't know anything about the LCD format, so I don't know if there's something else that is supposed to go in there. The saved LCD files I have are binary formatted.

When you say parts/textures, do you mean within a parts library? Or does it go somewhere else?

DLu commented 6 years ago

Actually, I just realized this newer version uses ldr files. The question still remains where the images go.

leozide commented 6 years ago

The LCD format is deprecated, you can read files but cannot save anymore.

The parts/textures folder inside your LDraw library folder (something like /home/dlu/ldraw/parts/textures).

DLu commented 6 years ago

The combination of those two elements got it. Thanks!