LDraw.org Discussion Forums
3D Part Preview added to Parts Tracker - Printable Version

+- LDraw.org Discussion Forums (https://forums.ldraw.org)
+-- Forum: General (https://forums.ldraw.org/forum-12.html)
+--- Forum: LDraw.org Announcements (https://forums.ldraw.org/forum-1.html)
+--- Thread: 3D Part Preview added to Parts Tracker (/thread-23540.html)

Pages: 1 2 3 4 5 6 7 8 9 10 11


RE: 3D Part Preview added to Parts Tracker - Orion Pobursky - 2019-11-16

(2019-11-15, 18:38)Lasse Deleuran Wrote: Hi Orion,

Which part of the code is it that is causing issues?

There are currently two ways of enabling and disabling logos:

LDR.Studs.makeGenerators() which can be called before the model is loaded to ensure that studs will be constructed correctly. I do not think this is the best option for setting the values here.

and

LDR.Studs.setStuds() which can be called to overwrite the part types for studs. After it has been called, the other parts that use studs will have to be rebuilt. To rebuild, the function removeAllMeshes() on meshCollectors can be used before calling draw() to rebuild.

I am having trouble. I'm using the LDR.Studs.setStuds() method.

Right now I'm doing something like this:
Code:
LDR.Studs.setStuds(ldrLoader, ldrOptions.studHighContrast, ldrOptions.studLogo, () => ldrLoader.load(partID));
ldrLoader.partTypes = {}; // Reset all stored data in the loader.
ldrLoader.load(partID);

This doesn't seem to work no matter what value I set ldrOptions.studLogo to.


RE: 3D Part Preview added to Parts Tracker - Lasse Deleuran - 2019-11-16

(2019-11-16, 1:41)Orion Pobursky Wrote: I am having trouble. I'm using the LDR.Studs.setStuds() method.

Right now I'm doing something like this:
Code:
LDR.Studs.setStuds(ldrLoader, ldrOptions.studHighContrast, ldrOptions.studLogo, () => ldrLoader.load(partID));
ldrLoader.partTypes = {}; // Reset all stored data in the loader.
ldrLoader.load(partID);

This doesn't seem to work no matter what value I set ldrOptions.studLogo to.

The trick is to not clear the loaded data:

LDR.Studs.setStuds(ldrLoader, ldrOptions.studHighContrast = 0, ldrOptions.studLogo = 1, () => ldrLoader.load(partID));

sets the logo on studs.

LDR.Studs.setStuds(ldrLoader, ldrOptions.studHighContrast = 0, ldrOptions.studLogo = 0, () => ldrLoader.load(partID));

Clears the logo.

As an example, try to fire these commands in the console here: https://www.ldraw.org/parts/official-part-lookup.html?folder=parts&partid=3024


RE: 3D Part Preview added to Parts Tracker - Orion Pobursky - 2019-11-16

(2019-11-16, 15:30)Lasse Deleuran Wrote: The trick is to not clear the loaded data:

LDR.Studs.setStuds(ldrLoader, ldrOptions.studHighContrast = 0, ldrOptions.studLogo = 1, () => ldrLoader.load(partID));

sets the logo on studs.

LDR.Studs.setStuds(ldrLoader, ldrOptions.studHighContrast = 0, ldrOptions.studLogo = 0, () => ldrLoader.load(partID));

Clears the logo.

As an example, try to fire these commands in the console here: https://www.ldraw.org/parts/official-part-lookup.html?folder=parts&partid=3024

Works for the official library (with some camera shenanigans) but not the PT even though it's literally the same code. Weird. I guess I'll have to troubleshoot more.


RE: 3D Part Preview added to Parts Tracker - Lasse Deleuran - 2019-11-17

(2019-11-16, 23:19)Orion Pobursky Wrote: Works for the official library (with some camera shenanigans) but not the PT even though it's literally the same code. Weird. I guess I'll have to troubleshoot more.
Hi Orion. Did you already fix this?

When I fire the command on https://www.ldraw.org/cgi-bin/ptdetail.cgi?f=parts/60583b.dat, it works.


RE: 3D Part Preview added to Parts Tracker - Orion Pobursky - 2019-11-17

(2019-11-17, 20:16)Lasse Deleuran Wrote: Hi Orion. Did you already fix this?

When I fire the command on https://www.ldraw.org/cgi-bin/ptdetail.cgi?f=parts/60583b.dat, it works.

Not working for regular studs (yet):
https://www.ldraw.org/cgi-bin/ptdetail.cgi?f=parts/30303.dat

I'm currently refactoring all the code so any fix will be incorporated into that.


RE: 3D Part Preview added to Parts Tracker - Lasse Deleuran - 2019-12-16

In the latest push to master, I have added support for texmap. By default textures are found in the folder "textures". 

For other placements, the options parameter "idToTextureUrl" can be set. This is a function that takes a texture name and returns the location of the texture file.

Please see the following examples:

sample_texmap_opaque.htm

sample_texmap_trans.htm

sample_texmap_inline.htm

The only existing limitation is the physical render where I am limited to how textures are mapped onto standard materials. This causes the textures to 'wrap to edges', rather than just cutting off:

[Image: 7ITR6HT.png]


RE: 3D Part Preview added to Parts Tracker - Orion Pobursky - 2019-12-17

(2019-12-16, 22:51)Lasse Deleuran Wrote: In the latest push to master, I have added support for texmap. By default textures are found in the folder "textures". 

For other placements, the options parameter "idToTextureUrl" can be set. This is a function that takes a texture name and returns the location of the texture file.

You didn’t need to create a new function. The texture path should always be <part path>/texture/<texture name>


RE: 3D Part Preview added to Parts Tracker - Lasse Deleuran - 2019-12-17

(2019-12-17, 0:11)Orion Pobursky Wrote: You didn’t need to create a new function. The texture path should always be <part path>/texture/<texture name>
I thought so as well, but I have had some issues with upper and lower case file names on one of my test sites. Now everyone has a handle to handle this issue, should it arise.


RE: 3D Part Preview added to Parts Tracker - Lasse Deleuran - 2020-01-09

I have misunderstood the purpose of "0 BFC CLIP" and "0 BFC NOCLIP", leading to incorrect behaviour when the parser encountered these statements. The updated code base has this fixed.


This was discovered while working on the implementation of the converter from Studio 2.0 textures to the LDraw Texmap standard.