LDraw.org Discussion Forums
3D Viewer work - Printable Version

+- LDraw.org Discussion Forums (https://forums.ldraw.org)
+-- Forum: Administrative (https://forums.ldraw.org/forum-4.html)
+--- Forum: Website Suggestions/Requests/Discussion (https://forums.ldraw.org/forum-23.html)
+--- Thread: 3D Viewer work (/thread-23755.html)

Pages: 1 2


3D Viewer work - Orion Pobursky - 2019-11-17

I'm gonna be refactoring the 3D view code used on the PT, Official Library pages, and OMR. You may notice some irregularities over the next week or so but don't worry it'll get fixed. Now is also the time for requests.


RE: 3D Viewer work - Magnus Forsberg - 2019-12-01

(2019-11-17, 19:52)Orion Pobursky Wrote: You may notice some irregularities

Is the extreme close-up when I use the "Add logo"-button a result of the ongoing re-coding?
btw, A logo is still not added when I use that button.

(2019-11-17, 19:52)Orion Pobursky Wrote: Now is also the time for requests.

Would it be possible to have the Reset/Return-button also reset the origin/orientation/zoom level?
As a user I want the Random and the BFC buttons to work like on/off-buttons, like the logo-button does.


RE: 3D Viewer work - Gerald Lasser - 2019-12-01

When reviewing 18909, I noticed that the 3D Viewer renders a stud logo for stud6, I think it should not.


RE: 3D Viewer work - Lasse Deleuran - 2019-12-01

(2019-12-01, 14:09)Magnus Forsberg Wrote: Is the extreme close-up when I use the "Add logo"-button a result of the ongoing re-coding?
btw, A logo is still not added when I use that button.
I am also looking into why this happens. It works for unofficial parts, but for some reason I can't figure out why the PT fails :S

I committed a bug fix to the source code recently... this could potentially fix the issue, but I am not at all convinced. There is something that we are missing here.


RE: 3D Viewer work - Orion Pobursky - 2019-12-01

(2019-12-01, 19:18)Lasse Deleuran Wrote: I am also looking into why this happens. It works for unofficial parts, but for some reason I can't figure out why the PT fails :S

I committed a bug fix to the source code recently... this could potentially fix the issue, but I am not at all convinced. There is something that we are missing here.

I ran into a snag with my refactored code (not related to your software) and haven't had time to troubleshoot.


RE: 3D Viewer work - Lasse Deleuran - 2019-12-06

(2019-12-01, 19:17)Gerald Lasser Wrote: When reviewing 18909, I noticed that the 3D Viewer renders a stud logo for stud6, I think it should not.
I just checked 18909 in dark blue from the Rexcelsior. The part has LEGO-logos in the bottom. However. The studs appear to be "stud2" rather than "stud6" as there are no flat section of the outer cylinder. Also. The studs should be oriented so the LEGO-logo has the bottom toward the flat cross section (where the other 18909 would be in a cone).


RE: 3D Viewer work - Magnus Forsberg - 2019-12-27

It looks like there's a webGL-viewer on some of the product pages at LEGO.

Ultrakatty and Emmet and Benny workshop

both have a "Explore in 3D" button in the corner.


.png   Image 1.png (Size: 111.45 KB / Downloads: 327)


RE: 3D Viewer work - Magnus Forsberg - 2020-01-11

The 3D viewer doesn't seem to work any longer. No image/model is generated.


RE: 3D Viewer work - Lasse Deleuran - 2020-01-11

(2020-01-11, 9:43)Magnus Forsberg Wrote: The 3D viewer doesn't seem to work any longer. No image/model is generated.
There was some work on it yesterday. Does it work for you when you refresh the page?

Right now it works for me, except BFC mode and the ability to turn on stud logos, see for example: https://www.ldraw.org/cgi-bin/ptdetail.cgi?f=parts/5306c01.dat


RE: 3D Viewer work - Magnus Forsberg - 2020-01-11

(2020-01-11, 9:54)Lasse Deleuran Wrote: Does it work for you when you refresh the page?

Right now it works for me, except BFC mode and the ability to turn on stud logos,

Yes, a refresh helped today. I see the same as you do. No BFC and no logo.
(win10 and firefox)


RE: 3D Viewer work - Orion Pobursky - 2020-01-12

(2020-01-11, 10:24)Magnus Forsberg Wrote: Yes, a refresh helped today. I see the same as you do. No BFC and no logo.
(win10 and firefox)

BFC mode seems to work for me. Stud logos are a known issue.


RE: 3D Viewer work - Philippe Hurbain - 2020-01-12

(2020-01-12, 6:40)Orion Pobursky Wrote: BFC mode seems to work for me.
I had problems with BFC mode too previously (surfaces not shown, as if backwards). But it does work now - mostly: on my windows PC, some cylinders (especially in studs but not only) appear blue, while they are normally green on my phone (both using Chrome).


RE: 3D Viewer work - Magnus Forsberg - 2020-01-12

(2020-01-12, 6:40)Orion Pobursky Wrote: BFC mode seems to work for me. Stud logos are a known issue.

And today, I too, see BFC working.....


RE: 3D Viewer work - Magnus Forsberg - 2020-01-22

Did you see this phenomenon?

https://www.ldraw.org/cgi-bin/ptdetail.cgi?f=parts/4066ap01.dat

   

It looks like this on my pc, win10 + Firefox.
It looked like this on my phone yesterday, andriod + chrome, but today it's OK,
and it looks good on my pc using win10 + Edge.
And it looked good on my work pc, win10 + chrome


RE: 3D Viewer work - Orion Pobursky - 2020-01-22

(2020-01-22, 15:42)Magnus Forsberg Wrote: Did you see this phenomenon?

https://www.ldraw.org/cgi-bin/ptdetail.cgi?f=parts/4066ap01.dat



It looks like this on my pc, win10 + Firefox.
It looked like this on my phone yesterday, andriod + chrome, but today it's OK,
and it looks good on my pc using win10 + Edge.
And it looked good on my work pc, win10 + chrome

Looks fine on my work machine, win10 + Firefox.  This might be a caching issue. For Firefox, try ctrl+shift+R on the page to see if this clears up the issue.


RE: 3D Viewer work - Philippe Hurbain - 2020-01-22

(2020-01-22, 15:48)Orion Pobursky Wrote: Looks fine on my work machine, win10 + Firefox.  This might be a caching issue. For Firefox, try ctrl+shift+R on the page to see if this clears up the issue.
Yes, works fine for me too now (without clearing cache). But if it's a cache issue, what did fill the cache with junk?


RE: 3D Viewer work - Gerald Lasser - 2020-01-22

Still looks strange after reloading the page, looks like it does not like the NDIS/CHRD combo...

   


RE: 3D Viewer work - Orion Pobursky - 2020-01-22

(2020-01-22, 17:00)Gerald Lasser Wrote: Still looks strange after reloading the page, looks like it does not like the NDIS/CHRD combo...

You have force reload everything, not just simply reload. On Firefox (and I think Chrome too), you can do this by doing ctrl-shift-R.


RE: 3D Viewer work - Magnus Forsberg - 2020-01-22

(2020-01-22, 18:21)Orion Pobursky Wrote: You have force reload everything, not just simply reload. On Firefox (and I think Chrome too), you can do this by doing ctrl-shift-R.

Yes, I have, but the same error is still there.


RE: 3D Viewer work - Gerald Lasser - 2020-01-22

(2020-01-22, 18:21)Orion Pobursky Wrote: You have force reload everything, not just simply reload. On Firefox (and I think Chrome too), you can do this by doing ctrl-shift-R.

I did so. (In Firefox) Still the issue

It works good in Chrome.
Huh


RE: 3D Viewer work - Orion Pobursky - 2020-01-22

(2020-01-22, 21:22)Gerald Lasser Wrote: I did so. (In Firefox) Still the issue

It works good in Chrome.
Huh

I've reproduced the error. Not sure why it's happening yet


RE: 3D Viewer work - Orion Pobursky - 2020-01-22

(2020-01-22, 21:38)Orion Pobursky Wrote: I've reproduced the error. Not sure why it's happening yet

Nevermind, you resubmitted the part with primitives removed.


RE: 3D Viewer work - Gerald Lasser - 2020-01-22

(2020-01-22, 21:39)Orion Pobursky Wrote: Nevermind, you resubmitted the part with primitives removed.

I resubmitted it a few times, the last one (At Wed Jan 22 22:25:01 2020) only the subfile, rest is commented out.
- I see a proper pre-view picture
- I get the proper download
- BUT: the 3D View shows me the pattern in Firefox, Chrome on PC is OK, (Incognito tab in FF is OK)

Chrome on Mobile shows me also the old preview with the pattern and the crazy render
Chrome on Mobile in Incognito Tab (no cache) works fine (render and preview)

Trying two more uploads

EDIT:

Original file works also in my FF incognito mode, but no chance for a standard tab.


RE: 3D Viewer work - Orion Pobursky - 2020-01-23

I'm not seeing any problems on any of my devices so this has got to be a stale cache issue.


RE: 3D Viewer work - Magnus Forsberg - 2020-01-23

And today it looks like the problem is gone!!
Strange.


RE: 3D Viewer work - Michael Horvath - 2020-01-24

(2019-11-17, 19:52)Orion Pobursky Wrote: I'm gonna be refactoring the 3D view code used on the PT, Official Library pages, and OMR. You may notice some irregularities over the next week or so but don't worry it'll get fixed. Now is also the time for requests.

I never noticed the 3D viewer on those pages (it's been a while...). Very nice, thanks!


RE: 3D Viewer work - Lasse Deleuran - 2020-02-06

I am currently looking into the issue of inconsistent display of overlapping transparent elements. While it is possible to enforce consistency by turning off "depth write" on transparent materials, this is an issue with LDraw since color 16 can be both transparent and opaque depending on the color to which it is assigned. As materials are combined, this is causing issues for BFC mode and for materials with both transparent and opaque sections.

I will instead look into the possibilities of using 3 materials per element (there is currently only one, hence the issues!)

1) Opaque material with depth write - This is rendered first
2) Color 16 material where depth write can be turned on and off - This is rendered second (so after any opaque material if 16 is a transparent color)
3) Transparent material without depth write - This is rendered last

This should fix the issues that we are currently observing on parts with mixed transparent and opaque sections. However. It requires some refactoring which might take me all weekend to get right.


RE: 3D Viewer work - Lasse Deleuran - 2020-02-08

(2020-02-06, 16:14)Lasse Deleuran Wrote: I am currently looking into the issue of inconsistent display of overlapping transparent elements. While it is possible to enforce consistency by turning off "depth write" on transparent materials, this is an issue with LDraw since color 16 can be both transparent and opaque depending on the color to which it is assigned. As materials are combined, this is causing issues for BFC mode and for materials with both transparent and opaque sections.

I will instead look into the possibilities of using 3 materials per element (there is currently only one, hence the issues!)

1) Opaque material with depth write - This is rendered first
2) Color 16 material where depth write can be turned on and off - This is rendered second (so after any opaque material if 16 is a transparent color)
3) Transparent material without depth write - This is rendered last

This should fix the issues that we are currently observing on parts with mixed transparent and opaque sections. However. It requires some refactoring which might take me all weekend to get right.

This has now been fixed in the latest push to master.

Please note that three Three.js group objects should now be fed to the MeshCollector constructor, and it complains if any are missing.

All sample and test files are updated.


RE: 3D Viewer work - Orion Pobursky - 2020-02-10

(2020-02-08, 1:03)Lasse Deleuran Wrote: This has now been fixed in the latest push to master.

Please note that three Three.js group objects should now be fed to the MeshCollector constructor, and it complains if any are missing.

All sample and test files are updated.

This is now implemented but textures are now broken for some reason.


RE: 3D Viewer work - Lasse Deleuran - 2020-02-10

(2020-02-10, 4:56)Orion Pobursky Wrote: This is now implemented but textures are now broken for some reason.
It turns out that this was a very old issue in the custom shader: I used the transparency of the underlying material, rather than the png to determine the amount to 'mix' between the two. With opaque materials, any transparent section of the png would become overwritten, hence the issue you observed.

It is fixed on the latest push to master - a one liner.


RE: 3D Viewer work - Orion Pobursky - 2020-02-10

(2020-02-10, 9:09)Lasse Deleuran Wrote: It turns out that this was a very old issue in the custom shader: I used the transparency of the underlying material, rather than the png to determine the amount to 'mix' between the two. With opaque materials, any transparent section of the png would become overwritten, hence the issue you observed.

It is fixed on the latest push to master - a one liner.

Nope, still not working:
https://www.ldraw.org/cgi-bin/ptdetail.cgi?f=parts/66645ap01.dat
https://www.ldraw.org/cgi-bin/ptdetail.cgi?f=parts/6005049a.dat


RE: 3D Viewer work - Orion Pobursky - 2020-02-10

(2020-02-10, 15:55)Orion Pobursky Wrote: Nope, still not working:
https://www.ldraw.org/cgi-bin/ptdetail.cgi?f=parts/66645ap01.dat
https://www.ldraw.org/cgi-bin/ptdetail.cgi?f=parts/6005049a.dat

More on this:

I have a console.log call every time idToTextureUrl is called to log what is being requested. Nothing is ever logged telling me that idToTextureUrl is never being called.


RE: 3D Viewer work - Lasse Deleuran - 2020-02-10

(2020-02-10, 18:07)Orion Pobursky Wrote: More on this:

I have a console.log call every time idToTextureUrl is called to log what is being requested. Nothing is ever logged telling me that idToTextureUrl is never being called.

I see one missing piece. The call "ldrLoader.loadTexmaps();" is missing. It should be called right before generateThreePart(). See the generate() method for comparison.

However. Calling this did not make the texture appear, so I am continuing debugging those two links you gave me.


RE: 3D Viewer work - Orion Pobursky - 2020-02-10

(2020-02-10, 18:58)Lasse Deleuran Wrote: I see one missing piece. The call "ldrLoader.loadTexmaps();" is missing. It should be called right before generateThreePart(). See the generate() method for comparison.

However. Calling this did not make the texture appear, so I am continuing debugging those two links you gave me.

I added that command and it now works for me. However, the texture doesn't show until the part is rotated in some cases.


RE: 3D Viewer work - Lasse Deleuran - 2020-02-10

(2020-02-10, 19:47)Orion Pobursky Wrote: I added that command and it now works for me. However, the texture doesn't show until the part is rotated in some cases.

That happens when the texture loads after the part. To overcome that, have render called in your onProgress:

Code:
    let onProgress = function() {
          render(); // Will be called once a part of texture is loaded.
    }

        let options = {
      onProgress:onProgress,
      ...    
        }
        ldrLoader = new THREE.LDRLoader(onLoad, storage, options);

On a related topic.

I have noticed that the search page (Parts Tracker File Scan) does not contain thumbnails. Is there a reason for this? I am working on a light thumbnail generator, which runs asynchroneously to generate thumbnails. See https://brickhub.org/bh/p/class.php?path=1&class=%3DMinifig as an example. Do you think such a feature would be useful?


RE: 3D Viewer work - Orion Pobursky - 2020-02-10

(2020-02-10, 21:47)Lasse Deleuran Wrote: I have noticed that the search page (Parts Tracker File Scan) does not contain thumbnails. Is there a reason for this? I am working on a light thumbnail generator, which runs asynchroneously to generate thumbnails. See https://brickhub.org/bh/p/class.php?path=1&class=%3DMinifig as an example. Do you think such a feature would be useful?

No real reason other than I haven't coded it in. We already have images of all the parts in the library (official and unofficial) so adding image wouldn't be too hard technically. The hitch is that the PT is entirely written in perl and isn't template based to it can be a pain to alter. We have plans to modernize it but that's in the far future. The 3D render capability is kind of bolted on in the most unintrusive way possible so it relies on jQuery for some functionality.

Thanks for the code. I'll try it out when I get home.


RE: 3D Viewer work - Orion Pobursky - 2020-02-11

Code worked great. Thanks again.


RE: 3D Viewer work - Magnus Forsberg - 2020-07-08

Could you please fix the 3D viewer on the part tracker?  For a long time now the random colour button don't do anything.


RE: 3D Viewer work - Orion Pobursky - 2020-07-08

(2020-07-08, 21:17)Magnus Forsberg Wrote: Could you please fix the 3D viewer on the part tracker?  For a long time now the random colour button don't do anything.

It works, it just messes up the camera positioning. BFC however does seem to be broken. And stud logo has never worked right. I'll try to fix all 3 issues shortly.


add 1 button for choosing BG color - Steffen - 2020-07-10

Hi Orion, just a small question in addition -
I'm playing with
https://www.ldraw.org/ldraw-model-viewer-test.html
and 1 thing I would like to have there would be a button which lets me pick the background color.
For some scenes, the default white does not work too well.
Maybe that's a small thing easy to add, just askin'.

best
Steffen


RE: add 1 button for choosing BG color - Orion Pobursky - 2020-07-10

(2020-07-10, 18:33)Steffen Wrote: Hi Orion, just a small question in addition -
I'm playing with
https://www.ldraw.org/ldraw-model-viewer-test.html
and 1 thing I would like to have there would be a button which lets me pick the background color.
For some scenes, the default white does not work too well.
Maybe that's a small thing easy to add, just askin'.

best
Steffen

I can do that. I'm currently knee deep in trying to fix the PT preview but I'll get your request done shortly. Also, please don't use the "test copy". I don't know how it ended up on the top level menu bar (it is now removed) but I'm constantly thinking with it so it may be broken at times. The "production" version is under the "Tools" menu.


RE: 3D Viewer work - Orion Pobursky - 2020-07-13

(2020-07-08, 21:17)Magnus Forsberg Wrote: Could you please fix the 3D viewer on the part tracker?  For a long time now the random colour button don't do anything.

Random colour, BFC, and show/hide studs now work correctly.


RE: 3D Viewer work - Philippe Hurbain - 2020-07-13

(2020-07-13, 2:42)Orion Pobursky Wrote: Random colour, BFC, and show/hide studs now work correctly.
Great, thanks! The only minor issue I found is that the stud logo button acts as a toggle, but the grey highlight doesn't toggle.


RE: 3D Viewer work - Magnus Forsberg - 2020-07-13

Great, thank you for fixing it. It works better now. Sort of.

in Firefox on Win 10
The logo button doesn't work. The button toggle an extreme close-up.
The viewer only works on complete Parts, not on subparts.

in Chrome on Andriod phone
The random colour doesn't work.
The logo button doesn't work. Toggle extreme close-up.
Displaying all parttypes.

in Edge on Win 10
All features seem to work. Including the grey high light on the logo button Philo wrote about.
Only displaying Parts, not subparts.


RE: 3D Viewer work - Lasse Deleuran - 2020-07-13

I have received a bug report on the main library showing that Android doesn't work well. My own Android phone is version 2.4, so it is a bit behind. I will try to make the library work with the latest version and then work my way back. The issues are typically caused by the rollout of WebGL features through the Android versions, so I have to detect which features that are available.


RE: 3D Viewer work - Orion Pobursky - 2020-07-13

I done a lot of changing on the back end. You may need to force your browser to reload cached files. Not sure how to do this on Android. On Firefox you do a Ctrl-Shift-R. On iOS Safari, press the "aA" icon on the left side of the menu bar and choose "Request Desktop Site".


RE: 3D Viewer work - Orion Pobursky - 2020-07-13

(2020-07-13, 6:17)Philippe Hurbain Wrote: Great, thanks! The only minor issue I found is that the stud logo button acts as a toggle, but the grey highlight doesn't toggle.

I noticed that. I think I accidentally removed the code the toggled the display element when I fixed the actual toggle.


RE: 3D Viewer work - Magnus Forsberg - 2020-07-13

(2020-07-13, 12:40)Orion Pobursky Wrote: I done a lot of changing on the back end. You may need to force your browser to reload cached files. Not sure how to do this on Android. On Firefox you do a Ctrl-Shift-R. On iOS Safari, press the "aA" icon on the left side of the menu bar and choose "Request Desktop Site".

I tried Ctrl+R a couple of times. Now the logo button work, but still no view on any subfile in Firefox and Edge.


RE: 3D Viewer work - Orion Pobursky - 2020-07-13

(2020-07-13, 13:06)Magnus Forsberg Wrote: I tried Ctrl+R a couple of times. Now the logo button work, but still no view on any subfile in Firefox and Edge.

Ctrl-R doesn't force reload cached items. You have to do Ctrl-Shift-R.


RE: 3D Viewer work - Magnus Forsberg - 2020-07-13

(2020-07-13, 13:57)Orion Pobursky Wrote: Ctrl-R doesn't force reload cached items. You have to do Ctrl-Shift-R.

Sorry, but I still don't get to view subfiles.

Like this one:
https://www.ldraw.org/cgi-bin/ptdetail.cgi?f=parts/s/3664s02.dat