LDraw.org Discussion Forums
Looking a tutorial to make a custom part! - Printable Version

+- LDraw.org Discussion Forums (https://forums.ldraw.org)
+-- Forum: Models and Parts (https://forums.ldraw.org/forum-18.html)
+--- Forum: Parts Authoring (https://forums.ldraw.org/forum-19.html)
+--- Thread: Looking a tutorial to make a custom part! (/thread-23013.html)

Pages: 1 2 3 4


RE: Looking a tutorial to make a custom part! - Travis Cobbs - 2018-11-07

(2018-11-06, 20:54)Roland Melkert Wrote:
(2018-11-06, 18:59)Travis Cobbs Wrote: Not sure about LDCad, though. I think the LDraw texturing spec makes it ambiguous about what the correct behavior is for the above. If LDCad has the texture's opacity match the underlying geometry, it won't show anything. If LDCad makes the texture itself fully opaque, it should match LDView.

The texture will become part of the underlying geometry, so it will indeed become invisible as a whole.

The ambiguity on this in the spec has come up before, but in practice I don't think you always want one or the other behavior. So we might need to make it an option somehow?

I'm not sure how to get the desired effect as wanted here using the fixed pipeline though, but I would certainly address it in the 2.0 engine.

I agree that being able to set the transparency of the texture independently of the transparency of the underlying geometry would be useful. LDView uses two passes to draw textures (which sometimes leads to texture static). The first pass draws the textured geometry in whatever color it might be, and the second draws just the texture. The texture pass uses the opacity from the alpha channel of the PNG file, but doesn't pay attention to the underlying geometry's transparency.

This is obviously not ideal, but even before LDView worked with textures on transparent geometry, that was the only way I could figure out to support both lit and unlit textures.


RE: Looking a tutorial to make a custom part! - Travis Cobbs - 2018-11-08

(2018-11-07, 5:06)Travis Cobbs Wrote: I agree that being able to set the transparency of the texture independently of the transparency of the underlying geometry would be useful.

Actually, as I think about this more, I don't think it would be a good idea to make the texture's transparency an option. I think it would be better if the spec said that all textures should be applied fully opaque, and only allow partial transparency via the alpha channel in the texture. So if you have a sticker that is partially transparent, then the transparent pixels in the texture should be partially transparent.

Of course, you already said that LDCad would have trouble having the texture be opaque when the underlying geometry is transparent, so I'm not sure that clarifying the spec in this way is really fair to you.


RE: Looking a tutorial to make a custom part! - Roland Melkert - 2018-11-09

(2018-11-08, 5:38)Travis Cobbs Wrote:
(2018-11-07, 5:06)Travis Cobbs Wrote: I agree that being able to set the transparency of the texture independently of the transparency of the underlying geometry would be useful.

Actually, as I think about this more, I don't think it would be a good idea to make the texture's transparency an option. I think it would be better if the spec said that all textures should be applied fully opaque, and only allow partial transparency via the alpha channel in the texture. So if you have a sticker that is partially transparent, then the transparent pixels in the texture should be partially transparent.

Of course, you already said that LDCad would have trouble having the texture be opaque when the underlying geometry is transparent, so I'm not sure that clarifying the spec in this way is really fair to you.

I was wondering about real life situations where the sticker should be transparent (like its handled in LDCad now), and couldn't think of any to be honest.

Using alpha<1.0 to make distinctions would be easy in shaders, but not in the fixed pipeline so it has to wait on 2.0 Smile


RE: Looking a tutorial to make a custom part! - Tatubias - 2018-11-13

(2018-11-09, 19:44)Roland Melkert Wrote:
(2018-11-08, 5:38)Travis Cobbs Wrote: Actually, as I think about this more, I don't think it would be a good idea to make the texture's transparency an option. I think it would be better if the spec said that all textures should be applied fully opaque, and only allow partial transparency via the alpha channel in the texture. So if you have a sticker that is partially transparent, then the transparent pixels in the texture should be partially transparent.

Of course, you already said that LDCad would have trouble having the texture be opaque when the underlying geometry is transparent, so I'm not sure that clarifying the spec in this way is really fair to you.

I was wondering about real life situations where the sticker should be transparent (like its handled in LDCad now), and couldn't think of any to be honest.

Using alpha<1.0 to make distinctions would be easy in shaders, but not in the fixed pipeline so it has to wait on 2.0 Smile


Im thinking in 2 options.

1 let ldcad automatically render alpha channel of the png files. and let those parts transparent.
2 they can modify the 0 !TEXMAP START PLANAR and add an extra parameter that gives you the alpha channel level from 0 opaque to 100 transpatrent.


RE: Looking a tutorial to make a custom part! - Simone - 2019-10-24

Hello
i reopen the thread because i'm trying to recreate the 1x6 brick 3067pb02
[Image: 250x250p.jpg?1561405074.4147894]
It does not exist on Stud.io or ldraw library so i tried to use a simple 3067 trans-red with the fork and cup sticker.
I create the transparent sticker with white fork and cup.
then i created a dat file into "..\ldraw\Unofficial\customparts\parts"
called 3067_fork.dat
The code inside is this:


Code:
0 ~Moved to 3067a
0 Name: 3067.dat
0 Author: [PTadmin]
0 !LDRAW_ORG Part UPDATE 2017-01
0 !LICENSE Redistributable under CCAL version 2.0 : see CAreadme.txt

0 BFC CERTIFY CCW

0 !HISTORY 2017-12-30 [PTadmin] Official Update 2017-01

0 // Brick  1 x  6 without Centre Studs

1 16 0 0 0 1 0 0 0 1 0 0 0 1 3067a.dat

0 !TEXMAP START PLANAR -60 0 -10 60 24 -10 -60 24 -10 3067pb02.png
4 16 -60 24 -10 60 24 -10 60 0 -10 -60 0 -10

0 !TEXMAP FALLBACK
4 16 -60 24 -10 60 24 -10 60 0 -10 -60 0 -10

0 !TEXMAP END

Tried and retried but the result is always the same. I can see right into LDCad but into Lpub3D i see this result:
[Image: 3067-error.png]

Here you are the PNG i used:
[Image: 3067pb02.png]

Where is my mistake?
Thanks for help

PS: if i change color of part to (example) red, it works prefectly.


RE: Looking a tutorial to make a custom part! - Philippe Hurbain - 2019-10-24

TEXMAP parts rendering on transparent part is not an easy task. What renderer do you use in LPub3D? (configuration ->preferences -> rendering tab)


RE: Looking a tutorial to make a custom part! - Simone - 2019-10-24

(2019-10-24, 13:24)Philippe Hurbain Wrote: TEXMAP parts rendering on transparent part is not an easy task. What renderer do you use in LPub3D? (configuration ->preferences -> rendering tab)

Sorry i forgot that. LDview


RE: Looking a tutorial to make a custom part! - Philippe Hurbain - 2019-10-24

(2019-10-24, 13:40)Simone Wrote: Sorry i forgot that. LDview
Your LDraw code is a bit wrong, since it uses a part with front face  and overlaps a front face with texmapped pattern. Attached a more correct version.
...but I doubt this is the source of your problem.
LDview renders front face as opaque:
[attachment=4117]
and LDCad renders the pattern as transparent:
[attachment=4116]


RE: Looking a tutorial to make a custom part! - Simone - 2019-10-24

(2019-10-24, 14:45)Philippe Hurbain Wrote: Your LDraw code is a bit wrong, since it uses a part with front face  and overlaps a front face with texmapped pattern. Attached a more correct version.
...but I doubt this is the source of your problem.
LDview renders front face as opaque:

and LDCad renders the pattern as transparent:

Also with your code i'm still getting the same behavior.
I thought I got the same result that you got with ldview. Where could I have gone wrong? Do I need to enable a particular setting on the LDview render engine?


RE: Looking a tutorial to make a custom part! - Philippe Hurbain - 2019-10-24

(2019-10-24, 15:02)Simone Wrote: Also with your code i'm still getting the same behavior.
I thought I got the same result that you got with ldview. Where could I have gone wrong? Do I need to enable a particular setting on the LDview render engine?
OK, I finally fired LPub3D, and see the same problem as you do, on this part or other texmapped ones (transparent). I guess you'll have to file in a bug report... https://github.com/trevorsandy/lpub3d/issues