3D Part Preview added to Parts Tracker


3D Part Preview added to Parts Tracker
#1
A 3D part preview has been added to the part detail pages on the Parts Tracker. If your machine is WebGL capable then you can click on the 3D View link on the menu to see that part in 3D. This feature is powered by brigl (https://github.com/HazenBabcock/brigl). Please report any bugs in the Website Discussion forum.

Known bugs:
- Mouse button actions not registered if done outside the model container (e.g. if you release a mouse button with the pointer outside the model container then if you reenter the container it behaves as if you never released the button)
- Direct colors don't work properly

Thanks,
Orion
Reply
RE: 3D Part Preview added to Parts Tracker
#2
(2019-07-08, 22:40)Orion Pobursky Wrote: A 3D part preview has been added to the part detail pages on the Parts Tracker. If your machine is WebGL capable then you can click on the 3D View link on the menu to see that part in 3D. This feature is powered by brigl (https://github.com/HazenBabcock/brigl). Please report any bugs in the Website Discussion forum.

Known bugs:
- Mouse button actions not registered if done outside the model container (e.g. if you release a mouse button with the pointer outside the model container then if you reenter the container it behaves as if you never released the button)
- Direct colors don't work properly

Thanks,
Orion

Based on the above bugs, I’m going to switch to Lasse Deleuran’s renderer (https://github.com/LasseD/buildinginstructions.js). It doesn’t have the above issues, is more compliant with the standard, and is being actively developed. Lasse was very responsive to a feature I requested to allow the switch and was kind enough to push an update in less than a day.
Reply
RE: 3D Part Preview added to Parts Tracker
#5
(2019-07-09, 15:17)Orion Pobursky Wrote: Based on the above bugs, I’m going to switch to Lasse Deleuran’s renderer (https://github.com/LasseD/buildinginstructions.js). It doesn’t have the above issues, is more compliant with the standard, and is being actively developed. Lasse was very responsive to a feature I requested to allow the switch and was kind enough to push an update in less than a day.

The switch is complete on the PT. OMR will stay on Brigl for the time being.
Reply
RE: 3D Part Preview added to Parts Tracker
#6
(2019-07-10, 23:21)Orion Pobursky Wrote: The switch is complete on the PT. OMR will stay on Brigl for the time being.

Doesn't work on Mobile Safari or Chrome for iOS. Does work on iOS Firefox.
Reply
RE: 3D Part Preview added to Parts Tracker
#7
(2019-07-11, 1:14)Orion Pobursky Wrote: Doesn't work on Mobile Safari or Chrome for iOS. Does work on iOS Firefox.
There seems to be an initialization/loading problem: on my phone (Android/chrome) I need to reload page to get to the 3d view. Otherwise I get only a narrow window with close and done buttons. But after that, it works well and is fast!
Reply
RE: 3D Part Preview added to Parts Tracker
#8
(2019-07-11, 6:57)Philippe Hurbain Wrote: There seems to be an initialization/loading problem: on my phone (Android/chrome) I need to reload page to get to the 3d view. Otherwise I get only a narrow window with close and done buttons. But after that, it works well and is fast!
Note: sometimes it works directly without reload.
Reply
RE: 3D Part Preview added to Parts Tracker
#9
(2019-07-11, 8:39)Philippe Hurbain Wrote: Note: sometimes it works directly without reload.

You gave me a possible solution to the problem. I tweaked the code and now it works on mobile Safari but the zoom is wrong. I'll troubleshoot this evening.
Reply
RE: 3D Part Preview added to Parts Tracker
#11
(2019-07-11, 8:39)Philippe Hurbain Wrote: Note: sometimes it works directly without reload.

Well my tweak didn’t work out. What’s odd is that it doesn’t work and then you refresh the page and it does. I’ll do some more google digging.
Reply
RE: 3D Part Preview added to Parts Tracker
#14
(2019-07-11, 1:14)Orion Pobursky Wrote: Doesn't work on Mobile Safari or Chrome for iOS. Does work on iOS Firefox.

This now seems to be fixed. I'm not sure what solved the problem since I only streamlined the code and didn't make any major changes.
Reply
RE: 3D Part Preview added to Parts Tracker
#24
(2019-07-13, 4:54)Orion Pobursky Wrote: This now seems to be fixed. I'm not sure what solved the problem since I only streamlined the code and didn't make any major changes.

With the recent changes, mobile is broken again. Ugh.
Reply
RE: 3D Part Preview added to Parts Tracker
#28
(2019-07-15, 2:06)Orion Pobursky Wrote: With the recent changes, mobile is broken again. Ugh.

Clarification: only broken on Mobile Safari.
Reply
RE: 3D Part Preview added to Parts Tracker
#16
looks very good, thank you very much.
Reply
RE: 3D Part Preview added to Parts Tracker
#27
(2019-07-09, 15:17)Orion Pobursky Wrote: Based on the above bugs, I’m going to switch to Lasse Deleuran’s renderer

There's one thing that I don't like with this renderer.
The center of rotation seems to fixed to the center of the window, instead of using the center of the part/model. If I move the part/model sideways and then want to rotate it, I have to guess and move it back into the center of the window. If I don't, the part/model will move around in a big circle, in the window. Is it possible to have a "re-center" button?
Reply
RE: 3D Part Preview added to Parts Tracker
#3
I am only happy to help. And please don't hesitate adding more change request. This is my favourite way to give back to the community.


Compared to brigl, buildinginstructions.js currently lacks a nice semi-realistic renderer. I know Nicola has spent a lot of time making the one in brigl where rounded parts look almost as if there are no transitions between polygons. It is on my list to come up with a nice one for buildinginstructions.js, but currently I can only offer the flat shader which looks similar to how LEGO makes instructions.
Reply
RE: 3D Part Preview added to Parts Tracker
#4
(2019-07-09, 16:33)Lasse Deleuran Wrote: I am only happy to help. And please don't hesitate adding more change request. This is my favourite way to give back to the community.


Compared to brigl, buildinginstructions.js currently lacks a nice semi-realistic renderer. I know Nicola has spent a lot of time making the one in brigl where rounded parts look almost as if there are no transitions between polygons. It is on my list to come up with a nice one for buildinginstructions.js, but currently I can only offer the flat shader which looks similar to how LEGO makes instructions.

Others may disagree but I actually think the flat, instructions style is better for our uses.
Reply
RE: 3D Part Preview added to Parts Tracker
#17
(2019-07-09, 16:36)Orion Pobursky Wrote: Others may disagree but I actually think the flat, instructions style is better for our uses.

I agree with you.
Our 3D viewer is not intended to make things beautiful and hide errors, but the opposite.
It needs to show everything in great clarity, to allow us to do what the PT is for:
finding glitches.
Reply
RE: 3D Part Preview added to Parts Tracker
#10
To follow up on a couple of feature requests from the internal pre-launch thread:
- BFC Colors
- Random quad/tri colors

Both of these features are possible with Lasse's renderer and will be added at some point in the near future.
Reply
RE: 3D Part Preview added to Parts Tracker
#18
super cool
Reply
RE: 3D Part Preview added to Parts Tracker
#22
(2019-07-11, 12:36)Orion Pobursky Wrote: To follow up on a couple of feature requests from the internal pre-launch thread:
- BFC Colors
- Random quad/tri colors

Both of these features are possible with Lasse's renderer and will be added at some point in the near future.

This is now implemented.

The icons could be better. The choices are from these:
https://fontawesome.com/icons?d=gallery&m=free
or some sending me good quality substitutes.
Reply
RE: 3D Part Preview added to Parts Tracker
#25
I don't know if that would be feasible, but instead of random coloring per facet, I'd find more useful a coloring per entity (single color for a primitive or subpart)
Reply
RE: 3D Part Preview added to Parts Tracker
#29
(2019-07-15, 18:20)Philippe Hurbain Wrote: I don't know if that would be feasible, but instead of random coloring per facet, I'd find more useful a coloring per entity (single color for a primitive or subpart)

I'm sure it's possible but Lasse will need to chime in about how to do it.
Reply
RE: 3D Part Preview added to Parts Tracker
#31
(2019-07-16, 2:00)Orion Pobursky Wrote: I'm sure it's possible but Lasse will need to chime in about how to do it.

A quick and dirty approach to this is to use the same type of method overwriting as for the other modes:

Code:
var acceptedColors = [1, 2, 4, 5, 13, 14, 19, 22, 25, 27, 69, 71, 72, 73, 74, 77, 288, 308, 484];
   THREE.LDRStep.prototype.addSubModel = function(subModel) {
     subModel.colorID = acceptedColors[Math.floor(Math.random() * acceptedColors.length)];
     this.subModels.push(subModel);
   }

This leaves each type of part with a random color. All studs on a brick will thus be colored the same random color.

If you want each part to have its own color (such as each stud on a brick in its own color) then additional functions have to be overwritten.
Reply
RE: 3D Part Preview added to Parts Tracker
#32
(2019-07-16, 6:41)Lasse Deleuran Wrote: A quick and dirty approach to this is to use the same type of method overwriting as for the other modes:

Code:
  var acceptedColors = [1, 2, 4, 5, 13, 14, 19, 22, 25, 27, 69, 71, 72, 73, 74, 77, 288, 308, 484];
   THREE.LDRStep.prototype.addSubModel = function(subModel) {
     subModel.colorID = acceptedColors[Math.floor(Math.random() * acceptedColors.length)];
     this.subModels.push(subModel);
   }

This leaves each type of part with a random color. All studs on a brick will thus be colored the same random color.

If you want each part to have its own color (such as each stud on a brick in its own color) then additional functions have to be overwritten.

I think what is wanted is the colors for all the quads/tri/and subparts in the top level file to be randomized.
Reply
RE: 3D Part Preview added to Parts Tracker
#33
(2019-07-16, 13:50)Orion Pobursky Wrote: I think what is wanted is the colors for all the quads/tri/and subparts in the top level file to be randomized.

The following should cover that scenario:

Code:
// Half-Harlequin-mode:
      var acceptedColors = [1, 2, 4, 5, 13, 14, 19, 22, 25, 27, 69, 71, 72, 73, 74, 77, 288, 308, 484];
      THREE.LDRStep.prototype.addSubModel = function(subModel) {
        subModel.colorID = acceptedColors[Math.floor(Math.random() * acceptedColors.length)];
        this.subModels.push(subModel);
      }
      LDR.LDRGeometry.prototype.fromPartType = function(loader, pt) {
        loader.getMainModel().IS_MAIN_MODEL = true;
        let geometries = [];
        if(pt.steps.length === 0) {
          console.warn("No steps in " + pt.ID);
          return; // Empty - just make empty.
        }
        if(pt.IS_MAIN_MODEL) { // Harlequin the triangles and quads:
          pt.steps.forEach(step => {
            step.quads.forEach(quad => quad.colorID = acceptedColors[Math.floor(Math.random() * acceptedColors.length)]);
            step.triangles.forEach(triangle => triangle.colorID = acceptedColors[Math.floor(Math.random() * acceptedColors.length)]);
          });
        }

        pt.steps.forEach(step => {
            let g = new LDR.LDRGeometry();
            g.fromStep(loader, step);
            geometries.push(g);
        });

        this.replaceWith(LDR.mergeGeometries(geometries));
      }

It took me a bit longer to come up with this solution that I would like to admit! Big Grin
Reply
RE: 3D Part Preview added to Parts Tracker
#35
(2019-07-18, 6:42)Lasse Deleuran Wrote: The following should cover that scenario:

Code:
      // Half-Harlequin-mode:
      var acceptedColors = [1, 2, 4, 5, 13, 14, 19, 22, 25, 27, 69, 71, 72, 73, 74, 77, 288, 308, 484];
      THREE.LDRStep.prototype.addSubModel = function(subModel) {
        subModel.colorID = acceptedColors[Math.floor(Math.random() * acceptedColors.length)];
        this.subModels.push(subModel);
      }
      LDR.LDRGeometry.prototype.fromPartType = function(loader, pt) {
        loader.getMainModel().IS_MAIN_MODEL = true;
        let geometries = [];
        if(pt.steps.length === 0) {
          console.warn("No steps in " + pt.ID);
          return; // Empty - just make empty.
        }
        if(pt.IS_MAIN_MODEL) { // Harlequin the triangles and quads:
          pt.steps.forEach(step => {
            step.quads.forEach(quad => quad.colorID = acceptedColors[Math.floor(Math.random() * acceptedColors.length)]);
            step.triangles.forEach(triangle => triangle.colorID = acceptedColors[Math.floor(Math.random() * acceptedColors.length)]);
          });
        }

        pt.steps.forEach(step => {
            let g = new LDR.LDRGeometry();
            g.fromStep(loader, step);
            geometries.push(g);
        });

        this.replaceWith(LDR.mergeGeometries(geometries));
      }

It took me a bit longer to come up with this solution that I would like to admit! Big Grin

I've implemented this but the rendering has errors:


.png   test.png (Size: 23.05 KB / Downloads: 554)
Reply
RE: 3D Part Preview added to Parts Tracker
#37
(2019-07-18, 22:38)Orion Pobursky Wrote: I've implemented this but the rendering has errors:
That's no good! Can you please share the file you are viewing?

I am unable to replicate the issue with the files I have on hand for testing.

EDIT: I found a part that fails. I will be able to look at this once I get home tonight.
Reply
RE: 3D Part Preview added to Parts Tracker
#38
(2019-07-19, 7:00)Lasse Deleuran Wrote: That's no good! Can you please share the file you are viewing?

I am unable to replicate the issue with the files I have on hand for testing.

EDIT: I found a part that fails. I will be able to look at this once I get home tonight.

The one pictured above is this one:

https://www.ldraw.org/cgi-bin/ptdetail.c...675ps1.dat
Reply
RE: 3D Part Preview added to Parts Tracker
#40
(2019-07-19, 12:20)Orion Pobursky Wrote: The one pictured above is this one:

https://www.ldraw.org/cgi-bin/ptdetail.c...675ps1.dat

This, in combination with the 'half harlequin' mode turned out to be a great stress test of the geometry-optimization for the renderer. I have pushed a fix of 'js/LDRGeometries' to master.

Content of the bug fix: This diff on GitHub
Reply
RE: 3D Part Preview added to Parts Tracker
#41
(2019-07-20, 11:12)Lasse Deleuran Wrote: This, in combination with the 'half harlequin' mode turned out to be a great stress test of the geometry-optimization for the renderer. I have pushed a fix of 'js/LDRGeometries' to master.

Content of the bug fix: This diff on GitHub

I pulled the latest updates and no errors that I can see.
Reply
RE: 3D Part Preview added to Parts Tracker
#43
(2019-07-20, 15:07)Orion Pobursky Wrote: I pulled the latest updates and no errors that I can see.

Primitives inside the subfile gets random colours. Don't think that was wanted/intended?

   

Here, the subfile is orange, and the primitives inside it is randomized.
https://www.ldraw.org/cgi-bin/ptdetail.c...85p137.dat
Reply
RE: 3D Part Preview added to Parts Tracker
#45
(2019-07-20, 15:33)Magnus Forsberg Wrote: Primitives inside the subfile gets random colours. Don't think that was wanted/intended?



Here, the subfile is orange, and the primitives inside it is randomized.
https://www.ldraw.org/cgi-bin/ptdetail.c...85p137.dat
Ah. That makes a lot of sense. I have pushed a new sample file where only the top level sub files are given random colors:

https://github.com/LasseD/buildinginstru...lequin.htm
Reply
RE: 3D Part Preview added to Parts Tracker
#46
(2019-07-20, 15:50)Lasse Deleuran Wrote: Ah. That makes a lot of sense. I have pushed a new sample file where only the top level sub files are given random colors:

https://github.com/LasseD/buildinginstru..._harlequin.

Implemented. No errors

See also my comments about studs at the bottom of the thread.
Reply
RE: 3D Part Preview added to Parts Tracker
#49
(2019-07-20, 16:30)Orion Pobursky Wrote: See also my comments about studs at the bottom of the thread.
Overall, works great and is damn fast! But for some reason I see nothing for this part https://www.ldraw.org/cgi-bin/ptdetail.c...44567a.dat (b version too)
Wish of the day: a 3d view button for official parts ....
Reply
RE: 3D Part Preview added to Parts Tracker
#53
(2019-07-21, 7:31)Philippe Hurbain Wrote: Overall, works great and is damn fast! But for some reason I see nothing for this part https://www.ldraw.org/cgi-bin/ptdetail.c...44567a.dat (b version too)
Wish of the day: a 3d view button for official parts ....
Maybe it's because Orion is working on it, 44567 work fine now. But 40066 and subpart give a blank screen here...
Reply
RE: 3D Part Preview added to Parts Tracker
#54
(2019-07-21, 18:30)Philippe Hurbain Wrote: Maybe it's because Orion is working on it, 44567 work fine now. But 40066 and subpart give a blank screen here...

I haven't done anything since yesterday. There's appear to be a bug in my path prefetch script that I can't troubleshoot on my phone so it'll have to wait until I'm home tonight.
Reply
RE: 3D Part Preview added to Parts Tracker
#56
(2019-07-21, 18:30)Philippe Hurbain Wrote: Maybe it's because Orion is working on it, 44567 work fine now. But 40066 and subpart give a blank screen here...

There's an error in this part (actually the subpart 40066s01). It references an invalid file which causes the renderer to fail.
Reply
RE: 3D Part Preview added to Parts Tracker
#44
(2019-07-20, 15:07)Orion Pobursky Wrote: I pulled the latest updates and no errors that I can see.
Excellent. I am looking into the BFC issue not. It is regarding BFC NOCLIP. The simple 'hack' to show BFC might be a bit too simple.
Reply
RE: 3D Part Preview added to Parts Tracker
#26
Maybe a "Paint brush" as Random colour-button, and a green "Leaf"  as BFC-button ?
Reply
RE: 3D Part Preview added to Parts Tracker
#30
(2019-07-15, 18:45)Magnus Forsberg Wrote: Maybe a "Paint brush" as Random colour-button, and a green "Leaf"  as BFC-button ?

Better than my choices. Done.
Reply
RE: 3D Part Preview added to Parts Tracker
#36
Looks like BFC coloring is fooled by noclip statements. See:
https://www.ldraw.org/cgi-bin/ptdetail.c...231p01.dat
https://www.ldraw.org/cgi-bin/ptdetail.c...69bpz4.dat
https://www.ldraw.org/cgi-bin/ptdetail.c...086ps1.dat
These files show 3 different types of wrong rendering.

Also: I have had problems with zooming level (goes to extreme zoom in) when rapidly switching between rendering modes and rotate view. So far I've not been able to reproduce this reliably.
Reply
RE: 3D Part Preview added to Parts Tracker
#39
(2019-07-19, 6:44)Philippe Hurbain Wrote: Looks like BFC coloring is fooled by noclip statements. See:
https://www.ldraw.org/cgi-bin/ptdetail.c...231p01.dat
https://www.ldraw.org/cgi-bin/ptdetail.c...69bpz4.dat
https://www.ldraw.org/cgi-bin/ptdetail.c...086ps1.dat
These files show 3 different types of wrong rendering.

I already noticed this and PM'd Lasse

(2019-07-19, 6:44)Philippe Hurbain Wrote: Also: I have had problems with zooming level (goes to extreme zoom in) when rapidly switching between rendering modes and rotate view. So far I've not been able to reproduce this reliably.

This is probably caused by 2 bits of code trying to run at the same time since part loading is asynchonous.
Reply
RE: 3D Part Preview added to Parts Tracker
#91
(2019-07-11, 12:36)Orion Pobursky Wrote: To follow up on a couple of feature requests from the internal pre-launch thread:
- BFC Colors
- Random quad/tri colors

Both of these features are possible with Lasse's renderer and will be added at some point in the near future.
Another addition that would be useful (no idea of complexity involved!): possibility to display an origin/axis thingy to allow quick check of part origin and orientation...
Reply
RE: 3D Part Preview added to Parts Tracker
#92
(2019-10-25, 12:18)Philippe Hurbain Wrote: Another addition that would be useful (no idea of complexity involved!): possibility to display an origin/axis thingy to allow quick check of part origin and orientation...

I do not know what will be the best place to have these requests, so I have added it to the issues list here: https://github.com/LasseD/buildinginstructions.js/issues/26

I have also found that the 'physical' viewer has found some issues with parts - particularly when lines of type 2 and 5 overlap, when vertices do not overlap properly, and such. 
Reply
RE: 3D Part Preview added to Parts Tracker
#12
I can see a lot of the current waiting time is largely caused by the renderer guessing wrongly when trying to find the right location of a file (is the file a primitive, a part, official or unofficial). I would like to improve this and have made the following improved "guesser" available in the code base:

Code:
        if(id.startsWith('48/') || id.startsWith('8/')) {
          return [OFFICIAL_DIR + '/p/' + id,
                  UNOFFICIAL_DIR + '/p/' + id];
        }
        else if(id.startsWith('s/')) {
          return [OFFICIAL_DIR + '/parts/' + id,
                  UNOFFICIAL_DIR + '/parts/' + id];
        }
        else if(id.match(/[a-z][a-z].*\.dat/)) {
          return [OFFICIAL_DIR + '/p/' + id,
                  OFFICIAL_DIR + '/parts/' + id,
                  UNOFFICIAL_DIR + '/p/' + id,
                  UNOFFICIAL_DIR + '/parts/' + id];
        }
        else {
          return [OFFICIAL_DIR + '/parts/' + id,
                  OFFICIAL_DIR + '/p/' + id,
                  UNOFFICIAL_DIR + '/parts/' + id,
                  UNOFFICIAL_DIR + '/p/' + id];
        }

The first two branches are easy: If a part starts with "48/" then it is a high res primitive, and similarly for "8/" and "s/" being low-res primitives and sub parts, respectively. This is the same as the current code.

The trick is for other files: Is the file we want to load a primitive or a part?
The crude regular expression (where it says "match") tries to detect primitives. It triggers for any part name where two letters are adjacent, that is, without numbers between them.

Primitives, such as "4-4cyli.dat", "1-2disc.dat", "stud.dat" etc. all have two letters in their part id.

while parts are typically something along the lines of "3001.dat", "2461a.dat", etc. They very rarely have more than one letter next to each other (disregarding the ".dat" suffix).

This method is extremely crude, so I would like if anyone can make a better "guesser". I have tested it locally and the loading time more than halves!
Reply
RE: 3D Part Preview added to Parts Tracker
#13
(2019-07-12, 23:34)Lasse Deleuran Wrote: I can see a lot of the current waiting time is largely caused by the renderer guessing wrongly when trying to find the right location of a file (is the file a primitive, a part, official or unofficial). I would like to improve this and have made the following improved "guesser" available in the code base:

Code:
        if(id.startsWith('48/') || id.startsWith('8/')) {
          return [OFFICIAL_DIR + '/p/' + id,
                  UNOFFICIAL_DIR + '/p/' + id];
        }
        else if(id.startsWith('s/')) {
          return [OFFICIAL_DIR + '/parts/' + id,
                  UNOFFICIAL_DIR + '/parts/' + id];
        }
        else if(id.match(/[a-z][a-z].*\.dat/)) {
          return [OFFICIAL_DIR + '/p/' + id,
                  OFFICIAL_DIR + '/parts/' + id,
                  UNOFFICIAL_DIR + '/p/' + id,
                  UNOFFICIAL_DIR + '/parts/' + id];
        }
        else {
          return [OFFICIAL_DIR + '/parts/' + id,
                  OFFICIAL_DIR + '/p/' + id,
                  UNOFFICIAL_DIR + '/parts/' + id,
                  UNOFFICIAL_DIR + '/p/' + id];
        }

The first two branches are easy: If a part starts with "48/" then it is a high res primitive, and similarly for "8/" and "s/" being low-res primitives and sub parts, respectively. This is the same as the current code.

The trick is for other files: Is the file we want to load a primitive or a part?
The crude regular expression (where it says "match") tries to detect primitives. It triggers for any part name where two letters are adjacent, that is, without numbers between them.

Primitives, such as "4-4cyli.dat", "1-2disc.dat", "stud.dat" etc. all have two letters in their part id.

while parts are typically something along the lines of "3001.dat", "2461a.dat", etc. They very rarely have more than one letter next to each other (disregarding the ".dat" suffix).

This method is extremely crude, so I would like if anyone can make a better "guesser". I have tested it locally and the loading time more than halves!

Part of the "problem" is that for the PT I prioritize unofficial over official. Since most primitives aren't unofficial, that load has to fail before it'll try for the official version.
Reply
RE: 3D Part Preview added to Parts Tracker
#15
(2019-07-12, 23:34)Lasse Deleuran Wrote: Primitives, such as "4-4cyli.dat", "1-2disc.dat", "stud.dat" etc. all have two letters in their part id.

while parts are typically something along the lines of "3001.dat", "2461a.dat", etc. They very rarely have more than one letter next to each other (disregarding the ".dat" suffix).

This method is extremely crude, so I would like if anyone can make a better "guesser". I have tested it locally and the loading time more than halves!

If "p" were a sub-directory of "parts" it might help...
Reply
RE: 3D Part Preview added to Parts Tracker
#21
(2019-07-13, 5:07)Michael Horvath Wrote: If "p" were a sub-directory of "parts" it might help...

That's never going to happen. Aside from breaking every almost every model, pushing such a massive change through the PT would be nothing short of insane.
Reply
RE: 3D Part Preview added to Parts Tracker
#19
I suggest a different approach:
why not initially send a full list of all primitives available to the client before he starts to download individual files?
then he can know that everything else is a part. no more regex guessing.
the same goes for "unofficial files vs official file":
can't the client initially get a simple list of all unofficial (or: official) files?
he could even locally cache it.
then also no more guesswork with regexes would be needed.
Of course, if these lists get very large, the benefit would be spoiled, but currently I think:
- the download of such lists could be faster than N failed URL accesses
- the downloaded list could be cached on client side maybe
- it could be sent in compressed form
- it could be pre-calculated on the server

While I am writing this, I come to another idea:
the server knows everything about every file.
it knows what is a primitive and what is a part etc.,
and which one is official and which one is unofficial.
Thus, when a client requests to download some file, say 777.dat,
the server can help the client and compile a list of "meta" info for the client, telling him
which file is official and which one not, and the folder in which it is to be found.
The client would access something like
www.ldraw.org/get_list_of_required_files_for?777.dat
, and the server would reply with a JSON which could look like
Code:
{
   "official" :
   [
      { "s"    : [ "777s01.dat", "777s02.dat"   ] },
      { "p"    : [ "4-4disc.dat", "4-4cyli.dat" ] },
      { "p/48" : [ "2-4ndis.dat", "stud.dat"    ] },
      { "p/8"  : [ "2-4ndis.dat", "stud.dat"    ] }
   ],

   "unofficial" :
   [
      { "s" : [ "123s01.dat", "456s02.dat"   ] },
      { "p" : [ "3-4disc.dat", "3-4cyli.dat" ] }
   ]
}
This reply will make it easy for the client to construct the URL for downloading the required files.
Reply
RE: 3D Part Preview added to Parts Tracker
#23
(2019-07-13, 7:21)Steffen Wrote: The client would access something like
www.ldraw.org/get_list_of_required_files_for?777.dat
, and the server would reply with a JSON

I'll see what I can implement. This may take some time.
Reply
RE: 3D Part Preview added to Parts Tracker
#34
This is now implemented. Loading speed has greatly improved.
Reply
RE: 3D Part Preview added to Parts Tracker
#20
Those are all great ideas! It should be straight forward to make the guesser prioritize unofficial primitives over everything else when an unofficial element is being shown.

I have dug further into the idea of caching primitives client-side. Caching unofficial parts and primitives is a little troublesome since they might change, but caching official parts and primitives should be safe, right? This is what the ClientStorage.js does. I have updated the sample file to use this. It builds an "IndexedDB" store on the client with compressed geometries which are fetched before the code attempts to make a server call.

There is also an even more extreme measure (which can be turned off, of course): LDRGenerator.js. This generates the simplest of primitives directly in the code (like PrimGen2) and is even faster than the IndexedDB! Currently only 24 primitives are supported here, but this approach has great potential.

Oh. I almost forgot. The code not also supports high contrast studs and studs with logos (all 5 types of logos that are found in the LDraw unofficial primitives directory)

[Image: WneR0XW.png]
High contrast and logos can be configured using simple parameters:

ldrOptions.studHighContrast = 0; // Set to 1 for high contrast

ldrOptions.studLogo = 0; // 0 for no logo, 1 to 5 for logo types 1 to 5


I apologize for any typos. I was up the whole night because I got too deep into this... and it is quite fun.
Reply
RE: 3D Part Preview added to Parts Tracker
#42
I've compensated for the extra primitives added by the setStuds method in my path prefretch script and started playing around with this.

Looks good however the rounded stud tops don't render well in the flat, non-shiny, instructions-style format. High contrast also works quite well. 

I did get a "call stack to large" when trying to render parts with lots of studs (like baseplates) in quality 4 or 5. Example:
https://www.ldraw.org/cgi-bin/ptdetail.c.../10p01.dat
(Note: I have quality set at 0 on the PT so you'll have to download and use this part elsewhere to get the error)

Also, for PT purposes, can you add a non-rounded stud with line logo option?
Reply
RE: 3D Part Preview added to Parts Tracker
#47
(2019-07-20, 15:19)Orion Pobursky Wrote: I've compensated for the extra primitives added by the setStuds method in my path prefretch script and started playing around with this.

Looks good however the rounded stud tops don't render well in the flat, non-shiny, instructions-style format. High contrast also works quite well. 

I did get a "call stack to large" when trying to render parts with lots of studs (like baseplates) in quality 4 or 5. Example:
https://www.ldraw.org/cgi-bin/ptdetail.c.../10p01.dat
(Note: I have quality set at 0 on the PT so you'll have to download and use this part elsewhere to get the error)

Also, for PT purposes, can you add a non-rounded stud with line logo option?
Are you thinking of a hard edge stud like type 1 but with the raises sides like type 4?
Reply
RE: 3D Part Preview added to Parts Tracker
#48
(2019-07-20, 17:57)Lasse Deleuran Wrote: Are you thinking of a hard edge stud like type 1 but with the raises sides like type 4?

No. A combo of stud.dat with logo.dat.
Reply
RE: 3D Part Preview added to Parts Tracker
#50
(2019-07-20, 18:12)Orion Pobursky Wrote: No. A combo of stud.dat with logo.dat.
That would be the one you get when you set the stud type to 1, right? (stud.dat is the one with square sides, while logo.dat is the single line edge draw type)

[Image: 123.png]
Reply
RE: 3D Part Preview added to Parts Tracker
#57
You're right. For some reason I though it was different.
Reply
RE: 3D Part Preview added to Parts Tracker
#58
Ability to toggle stud logos on and off is now added.
Reply
RE: 3D Part Preview added to Parts Tracker
#51
(2019-07-21, 7:31)Philippe Hurbain Wrote: Wish of the day: a 3d view button for official parts ....

Yesss!
Reply
RE: 3D Part Preview added to Parts Tracker
#52
(2019-07-21, 9:58)Gerald Lasser Wrote: Yesss!

This is on the list but I have to figure out how I want to implement.
Reply
RE: 3D Part Preview added to Parts Tracker
#55
(2019-07-21, 16:00)Orion Pobursky Wrote: This is on the list but I have to figure out how I want to implement.
👍🏻
If nothing goes right, go left.
Reply
RE: 3D Part Preview added to Parts Tracker
#59
An update on the BFC color coding issue. There is an optimization in the way buildinginstructions.js generates the triangles shown on screen which stands in the way of proper color coding for BFC when there is a mix of culled and not culled primitives. I am currently writing a new triangle generator which circumvents this issue. However. It is still a work in progress. Hopefully to be finished this week. 

Current status is... a work in progress  Big Grin

[Image: zrErMWm.png]
Reply
RE: 3D Part Preview added to Parts Tracker
#60
I have now updated the geometry handling on buildinginstructions.js so that it no longer has the issue with non-culled sub models being merged with ones that are culled (this caused both sub models to not be culled in order to ensure no triangles were lost). 

There is a new Javascript file that should be included when showing BFC: js/LDRBFCGeometries.js

Once included, BFC can be turned on by running:

Code:
// Enable BFC:
      THREE.LDRPartType.prototype.ensureGeometry = function(loader) {
        if(!this.geometry) {
          this.geometry = new LDR.BFCGeometry();
          this.geometry.fromPartType(loader, this);
        }
      }

And rebuilding.


That said. The sample file is still a bit odd to my eye. Does anyone know if it is on purpose that one of the transparent sections has more surfaces, hence the darker hue of the transparent section? This is 44375bps0.dat

[Image: dr0SYDf.png]
Reply
RE: 3D Part Preview added to Parts Tracker
#61
(2019-07-23, 7:10)Lasse Deleuran Wrote: Does anyone know if it is on purpose that one of the transparent sections has more surfaces, hence the darker hue of the transparent section?

I don't see any error in the code of that part, but also doesn't understand where you think you see an error. This part should have four transparent sections, three LBG sections and one DBG section. Could you place an arrow or a ring around the issue?
Reply
RE: 3D Part Preview added to Parts Tracker
#62
(2019-07-23, 7:26)Magnus Forsberg Wrote: I don't see any error in the code of that part, but also doesn't understand where you think you see an error. This part should have four transparent sections, three LBG sections and one DBG section. Could you place an arrow or a ring around the issue?
Check out the darkness of the top left and bottom right windows. in the picture. They show darker panes than the rest of the transparent sections. This is due to additional transparent (color 40) triangles being drawn on top of each other.

Either there are multiple parts lying on top of each other, or I have made an error in the renderer.
Reply
RE: 3D Part Preview added to Parts Tracker
#63
(2019-07-23, 8:06)Lasse Deleuran Wrote: Either there are multiple parts lying on top of each other, or I have made an error in the renderer.

I can't see anything wrong in the part, or its subparts, that would create extra surfaces. The four trans window panes are created by using the same subfile four times, one for each pane. If there was something wrong, you ought to have the same error in all four.
Reply
RE: 3D Part Preview added to Parts Tracker
#64
(2019-07-23, 9:54)Magnus Forsberg Wrote: I can't see anything wrong in the part, or its subparts, that would create extra surfaces. The four trans window panes are created by using the same subfile four times, one for each pane. If there was something wrong, you ought to have the same error in all four.
This tells me that the renderer is making a mistake. I will look into it.
Reply
RE: 3D Part Preview added to Parts Tracker
#65
(2019-07-23, 10:01)Lasse Deleuran Wrote: This tells me that the renderer is making a mistake. I will look into it.

I don't see the problem when viewing the part from a similar angle in LDView:

   

--Travis
Reply
RE: 3D Part Preview added to Parts Tracker
#69
(2019-07-23, 17:28)Travis Cobbs Wrote: I don't see the problem when viewing the part from a similar angle in LDView:



--Travis

I have found the issue. It is due to how WebGL handles drawing order. I have reduced the error to these 3 transparent quads for an example:

[Image: t2hEM3S.png]

There is one big quad in the background, and two smaller quads flying in front of it. All in the same color (trans black color 40).

On the top of the right side you can see they are in the same geometry, so they are belonging to the same "Object" being drawn by WebGL.

The reason why only one of them works correctly is their order in the object: The small left triangle comes first, then the big one, and the failing one to the right comes last.

WebGL only renders transparent triangles correctly when they are drawn before the stuff behind. This is the reason why I am separating transparent and opaque stuff in the code base. Unfortunately I do not know how to fix this issue without either making all transparent geometries not culled, or do some crazy inefficient sorting before rendering.

So what do you guys think? Is this a big enough issue to reduce efficiency by not culling transparent elements, or should it just be left like this?
Reply
RE: 3D Part Preview added to Parts Tracker
#70
How noticable can these errors be? If it's something that will be noticed only for those who know about the error or only under extreme zoom then I think it's a non-issue.
Reply
RE: 3D Part Preview added to Parts Tracker
#71
(2019-07-24, 13:54)Lasse Deleuran Wrote: WebGL only renders transparent triangles correctly when they are drawn before the stuff behind. This is the reason why I am separating transparent and opaque stuff in the code base. Unfortunately I do not know how to fix this issue without either making all transparent geometries not culled, or do some crazy inefficient sorting before rendering.

So what do you guys think? Is this a big enough issue to reduce efficiency by not culling transparent elements, or should it just be left like this?

I've never used WebGL, but for rasterizer-based 3D rendering in general (and OpenGL in specific), you typically need to draw the transparent objects last, not first. That's the only way opaque geometry behind them will be visible through them. Furthermore, you typically want to render the transparent geometry from back to front, not from front to back. Once again, that's so that the transparent stuff in back is visible through the stuff in front. (There is a technique called depth peeling that allows you to render transparent geometry in arbitrary order, but it has a maximum number of overlapping transparent polygons that can be drawn correctly.)

LDView sorts transparent polygons by default (although it does so in multiple threads), and the performance is usually acceptable, since the total number of transparent polygons is usually manageable. Certainly for displaying parts, sorting should be plenty fast. One thing that might improve the results for parts without requiring sorting is to disable Z-buffer writes during transparent polygon drawing. (Leave depth testing enabled, but don't update the depth buffer during transparent drawing.) With non-lit transparent polygons that are the same color, this would (I think) completely fix the problem. If two different colored transparent polygons overlap, the result could be wrong (although it might still be better than what you have now; you'd have to test).
Reply
RE: 3D Part Preview added to Parts Tracker
#72
(2019-07-24, 17:12)Travis Cobbs Wrote: I've never used WebGL, but for rasterizer-based 3D rendering in general (and OpenGL in specific), you typically need to draw the transparent objects last, not first. That's the only way opaque geometry behind them will be visible through them. Furthermore, you typically want to render the transparent geometry from back to front, not from front to back. Once again, that's so that the transparent stuff in back is visible through the stuff in front. (There is a technique called depth peeling that allows you to render transparent geometry in arbitrary order, but it has a maximum number of overlapping transparent polygons that can be drawn correctly.)

LDView sorts transparent polygons by default (although it does so in multiple threads), and the performance is usually acceptable, since the total number of transparent polygons is usually manageable. Certainly for displaying parts, sorting should be plenty fast. One thing that might improve the results for parts without requiring sorting is to disable Z-buffer writes during transparent polygon drawing. (Leave depth testing enabled, but don't update the depth buffer during transparent drawing.) With non-lit transparent polygons that are the same color, this would (I think) completely fix the problem. If two different colored transparent polygons overlap, the result could be wrong (although it might still be better than what you have now; you'd have to test).
You are right. It must be drawn back-to-front. And thanks for the pointers. I will look into the depth buffer fix and other algorithms to improve this aspect. 

My biggest issue is performance. I am used to write in C++, so the performance aspects of this all being written in Javascript (and GLSL) is an adventure!
Reply
RE: 3D Part Preview added to Parts Tracker
#66
This is now implemented
Reply
RE: 3D Part Preview added to Parts Tracker
#67
(2019-07-23, 22:30)Orion Pobursky Wrote: This is now implemented

Turning on BFC highlighting on 44375bps0 no results in no display. (There is initially no update, but when you then spin, it disappears.)
Reply
RE: 3D Part Preview added to Parts Tracker
#68
(2019-07-23, 23:37)Travis Cobbs Wrote: Turning on BFC highlighting on 44375bps0 no results in no display. (There is initially no update, but when you then spin, it disappears.)

Seems to work on my phone. Try a ctrl-shift-r to reload the cached scripts.
Reply
RE: 3D Part Preview added to Parts Tracker
#75
(2019-07-23, 23:51)Orion Pobursky Wrote: Seems to work on my phone. Try a ctrl-shift-r to reload the cached scripts.
I have found the hack of adding unused query parameters with the timestamp of files works fairly well to avoid browser caching of updated files.

So instead of "file.js", the URL is "file.js?t=2019-07-30-13-44.

The need comes especially from mobile platforms. As an example. I am unable to hard refresh on iPhone standard browser without deleting all browser data.
Reply
RE: 3D Part Preview added to Parts Tracker
#76
(2019-07-28, 14:44)Lasse Deleuran Wrote: The need comes especially from mobile platforms. As an example. I am unable to hard refresh on iPhone standard browser without deleting all browser data.

Fir mobile safari it easy. Just long press on the reload button and choose "reload without content blockers". This'll refresh everything for the page.
Reply
RE: 3D Part Preview added to Parts Tracker
#77
(2019-07-28, 19:42)Orion Pobursky Wrote: Fir mobile safari it easy. Just long press on the reload button and choose "reload without content blockers". This'll refresh everything for the page.
OK. That is the last time I'm taking advice from google. I ended up implementing the timestamp trick site-wide to prevent this issue!  Confused
Reply
RE: 3D Part Preview added to Parts Tracker
#73
Ok, Steffen, I relent (mostly because I figured out how to do it without affecting non-WebGL clients). You can now click the image to get the 3d View and browsers without WebGL will behave normally.
Reply
RE: 3D Part Preview added to Parts Tracker
#74
(2019-07-28, 4:54)Orion Pobursky Wrote: Ok, Steffen, I relent (mostly because I figured out how to do it without affecting non-WebGL clients). You can now click the image to get the 3d View and browsers without WebGL will behave normally.
Convenient, thanks!
Otherwise, I can't 3D view some obsoletized shortcuts, such as https://www.ldraw.org/cgi-bin/ptdetail.cgi?s=4100338 (blank window). Not that it bothers me much, but...
Reply
RE: 3D Part Preview added to Parts Tracker
#78
I have added stud logos to the following stud types in the library (the change is pushed to the latest version of the master branch of buildinginstructions.js):

studp01
studel
studa
stud10
stud15
stud17
stud13
stud6


Unfortunately this has surfaced some issues. I recall having read that stud logos should not be mirrored, even when found on mirror geometries. If I can find where this is written, then I can try to "unmirror" logos that are shown.

The issues are documented here: https://github.com/LasseD/buildinginstru.../issues/22

And I am copying them below:


Adding logos on studp01.dat reveals issue with stud rotation on u1454p01.dat
https://www.ldraw.org/parts/official-par...d=u1454p01
See: https://brickhub.org/p/u1454p01



Adding logos on stud15.dat reveals issues with stud rotation on 92947.dat
See: https://brickhub.org/p/92947



Adding logos on stud17.dat reveals the following issues:
For 6042.dat:
https://www.ldraw.org/parts/official-par...artid=6042
using:
https://www.ldraw.org/parts/official-par...=s/6042s01
Logos are only present in the top studs. They all face the same direction ('L' toward the sideways stud section). With s/6042s01.dat being used mirrored, the logos are incorrectly shown.
See: https://brickhub.org/p/6042
For 6032.dat:
https://www.ldraw.org/parts/official-par...=s/6042s01
using:
https://www.ldraw.org/official-part-look...032s01.dat
There should be a logo in the inner stud (The letters 'L' and 'O' are visible in the left side of the real part due to a molding point, while the right inner stud contains an encircled 'C'). Due to no logo being completely visible on the real part, my vote is for not changing the LDraw part to use stud17.dat.
See: https://brickhub.org/p/6032



Adding logos on stud13.dat shows an issue with 4773a.dat where mirroring and rotations result in stud logos being shown wrongly.
See: https://brickhub.org/p/4773a


Adding logos on stud6.dat shows an issue with 17485.dat where rotations result in stud logos being shown wrongly.
https://www.ldraw.org/parts/official-par...rtid=17485
See: https://brickhub.org/p/17485


Edit: If you do not see logos in the brickhub pages, then please visit https://brickhub.org/i/p.php?model=457 (a random parts list) and press the "LEGO" button in the settings below. After this the logos should appear on parts pages as well. I am currently looking into getting this functionality copied to the parts pages so you don't need this workaround.
Reply
RE: 3D Part Preview added to Parts Tracker
#79
The 3D part preview seem to be case sensitive.

I made three new files, 3815bpw1c01 - 3815bpw3c01.
They all had code like this:
Code:
1 16 0 0 0 1 0 0 0 1 0 0 0 1 3815b.DAT
1 16 0 12 0 1 0 0 0 1 0 0 0 1 3816bpw3.DAT
1 16 0 12 0 1 0 0 0 1 0 0 0 1 3817bpw3.DAT
None of them showed up in the 3D viewer.

Then I changed two files: 3815bpw1c01 - 3815bpw2c01
Code:
1 1 0 0 0 1 0 0 0 1 0 0 0 1 3815b.dat
1 16 0 12 0 1 0 0 0 1 0 0 0 1 3816bpw2.dat
1 16 0 12 0 1 0 0 0 1 0 0 0 1 3817bpw2.dat
and now they are visible in the 3D viewer.

I left the third file 3815bpw3c01 unchanged.
Reply
RE: 3D Part Preview added to Parts Tracker
#80
Ah, this explains why sometimes I see nothing... That said, file names in official library are supposed to be lower case and referenced this way (but a lot of file contain capital letters). LDPE issues a warning for that.
Reply
RE: 3D Part Preview added to Parts Tracker
#81
(2019-09-08, 15:31)Magnus Forsberg Wrote: The 3D part preview seem to be case sensitive.

I made three new files, 3815bpw1c01 - 3815bpw3c01.
They all had code like this:
Code:
1 16 0 0 0 1 0 0 0 1 0 0 0 1 3815b.DAT
1 16 0 12 0 1 0 0 0 1 0 0 0 1 3816bpw3.DAT
1 16 0 12 0 1 0 0 0 1 0 0 0 1 3817bpw3.DAT
None of them showed up in the 3D viewer.

Then I changed two files: 3815bpw1c01 - 3815bpw2c01
Code:
1 1 0 0 0 1 0 0 0 1 0 0 0 1 3815b.dat
1 16 0 12 0 1 0 0 0 1 0 0 0 1 3816bpw2.dat
1 16 0 12 0 1 0 0 0 1 0 0 0 1 3817bpw2.dat
and now they are visible in the 3D viewer.

I left the third file 3815bpw3c01 unchanged.

The server is case sensitive so I probably just need to lower case my url search code.
Reply
RE: 3D Part Preview added to Parts Tracker
#82
(2019-09-08, 15:31)Magnus Forsberg Wrote: The 3D part preview seem to be case sensitive.

I made three new files, 3815bpw1c01 - 3815bpw3c01.
They all had code like this:
Code:
1 16 0 0 0 1 0 0 0 1 0 0 0 1 3815b.DAT
1 16 0 12 0 1 0 0 0 1 0 0 0 1 3816bpw3.DAT
1 16 0 12 0 1 0 0 0 1 0 0 0 1 3817bpw3.DAT
None of them showed up in the 3D viewer.

Then I changed two files: 3815bpw1c01 - 3815bpw2c01
Code:
1 1 0 0 0 1 0 0 0 1 0 0 0 1 3815b.dat
1 16 0 12 0 1 0 0 0 1 0 0 0 1 3816bpw2.dat
1 16 0 12 0 1 0 0 0 1 0 0 0 1 3817bpw2.dat
and now they are visible in the 3D viewer.

I left the third file 3815bpw3c01 unchanged.

Should be fixed now.
Reply
RE: 3D Part Preview added to Parts Tracker
#83
It looks like something is wrong in the viewer. The random colour button also randomize some of the vertices and break the model geometry.
Reply
RE: 3D Part Preview added to Parts Tracker
#84
(2019-09-09, 9:15)Magnus Forsberg Wrote: It looks like something is wrong in the viewer. The random colour button also randomize some of the vertices and break the model geometry.
That sounds bad. Do you have a sample file where this is observed?
Reply
RE: 3D Part Preview added to Parts Tracker
#85
(2019-09-09, 10:01)Lasse Deleuran Wrote: That sounds bad. Do you have a sample file where this is observed?
I've seen it on two different pc's, on two different parts, 44301a.dat and 93575.dat. These are recently updated parts on the PT.
Reply
RE: 3D Part Preview added to Parts Tracker
#87
(2019-09-09, 11:55)Magnus Forsberg Wrote: I've seen it on two different pc's, on two different parts, 44301a.dat and 93575.dat. These are recently updated parts on the PT.
Here too. Especially impressive for https://www.ldraw.org/cgi-bin/ptdetail.c.../u9479.dat
Reply
RE: 3D Part Preview added to Parts Tracker
#86
(2019-09-09, 10:01)Lasse Deleuran Wrote: That sounds bad. Do you have a sample file where this is observed?

Can confirm. Just use any part on the tracker. The more triangles, the better.
Reply
RE: 3D Part Preview added to Parts Tracker
#88
Excellent. Thanks. I see it now too. I will make a local copy and start debugging this evening.

Edit: It seems to be due to poor vertex attribute construction. Unfortunately the bug only appears intermittendly once I reduce the input :S


[.WebGL-0x7fbd710dd000]GL ERROR :GL_INVALID_OPERATION : glDrawElements: attempt to access out of range vertices in attribute 0
Reply
RE: 3D Part Preview added to Parts Tracker
#89
Bug identified and fixed in latest push to master branch.

I made the mistake of using the same markers for line vertices and triangle vertices, resulting in triangle vertices being marked as already being in use when they were not. This sometimes resulted in fancy gradient colors, and sometimes complete failures of texture loading.

Thanks for the bus report. This error would otherwise have affected all multi-colored parts.
Reply
RE: 3D Part Preview added to Parts Tracker
#90
(2019-09-09, 21:22)Lasse Deleuran Wrote: Bug identified and fixed in latest push to master branch.

I made the mistake of using the same markers for line vertices and triangle vertices, resulting in triangle vertices being marked as already being in use when they were not. This sometimes resulted in fancy gradient colors, and sometimes complete failures of texture loading.

Thanks for the bus report. This error would otherwise have affected all multi-colored parts.

Update pulled to server. Everything appears to be fixed.
Reply
RE: 3D Part Preview added to Parts Tracker
#93
The "Toggle stud logos"- button doesn't work anymore. No logo is added when I click on it.
(Win 10 1903 + Firefox (updated), but I saw this prior to the latest Win update.)
Reply
RE: 3D Part Preview added to Parts Tracker
#94
(2019-11-12, 16:11)Magnus Forsberg Wrote: The "Toggle stud logos"- button doesn't work anymore. No logo is added when I click on it.
(Win 10 1903 + Firefox (updated), but I saw this prior to the latest Win update.)
Confirmed with another OS/browser
Reply
RE: 3D Part Preview added to Parts Tracker
#95
(2019-11-12, 16:32)Philippe Hurbain Wrote: Confirmed with another OS/browser

Thanks for the report. The way studs are handled has changed so I'll have to retool my stud toggle code. This should be fixed by tomorrow.
Reply
RE: 3D Part Preview added to Parts Tracker
#96
(2019-11-12, 17:10)Orion Pobursky Wrote: Thanks for the report. The way studs are handled has changed so I'll have to retool my stud toggle code. This should be fixed by tomorrow.
Sorry about that. I thought I had tested this back when the changes were made (see my post with all the stud types)

Please tell me if there are any issues with the change.
Reply
RE: 3D Part Preview added to Parts Tracker
#97
(2019-11-12, 19:30)Lasse Deleuran Wrote: Sorry about that. I thought I had tested this back when the changes were made (see my post with all the stud types)

Please tell me if there are any issues with the change.

I knew about the change but didn’t implement because I forgot. I had planned to centralize all the render code into one file but real life got in the way and I didn’t finish that either. I’ll have much more free time in the next few weeks to work on my website todo list
Reply
RE: 3D Part Preview added to Parts Tracker
#98
(2019-11-12, 20:08)Orion Pobursky Wrote: I knew about the change but didn’t implement because I forgot. I had planned to centralize all the render code into one file but real life got in the way and I didn’t finish that either. I’ll have much more free time in the next few weeks to work on my website todo list

Still working in this. The limited amount of tweaking I did yesterday didn't solve the problem.
Reply
RE: 3D Part Preview added to Parts Tracker
#99
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.
Reply
RE: 3D Part Preview added to Parts Tracker
(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 haven't gotten back to this yet. I'll have time this evening to work on a fix.
Reply
RE: 3D Part Preview added to Parts Tracker
(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.
Reply
RE: 3D Part Preview added to Parts Tracker
(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-par...artid=3024
Reply
RE: 3D Part Preview added to Parts Tracker
(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-par...artid=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.
Reply
RE: 3D Part Preview added to Parts Tracker
(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.c...60583b.dat, it works.
Reply
RE: 3D Part Preview added to Parts Tracker
(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.c...60583b.dat, it works.

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

I'm currently refactoring all the code so any fix will be incorporated into that.
Reply
« Next Oldest | Next Newest »



Forum Jump:


Users browsing this thread: 1 Guest(s)