3D Viewer work


3D Viewer work
#1
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.
Reply
RE: 3D Viewer work
#2
(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.
Reply
RE: 3D Viewer work
#4
(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.
Reply
RE: 3D Viewer work
#5
(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.
Reply
RE: 3D Viewer work
#3
When reviewing 18909, I noticed that the 3D Viewer renders a stud logo for stud6, I think it should not.
Reply
RE: 3D Viewer work
#6
(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).
Reply
RE: 3D Viewer work
#7
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: 196)
Reply
RE: 3D Viewer work
#8
The 3D viewer doesn't seem to work any longer. No image/model is generated.
Reply
RE: 3D Viewer work
#9
(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.c...306c01.dat
Reply
RE: 3D Viewer work
#10
(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)
Reply
RE: 3D Viewer work
#11
(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.
Reply
RE: 3D Viewer work
#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).


Attached Files Thumbnail(s)
   

.jpg   Capture.JPG (Size: 25.98 KB / Downloads: 152)
Reply
RE: 3D Viewer work
#13
(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.....
Reply
RE: 3D Viewer work
#14
Did you see this phenomenon?

https://www.ldraw.org/cgi-bin/ptdetail.c...66ap01.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
Reply
RE: 3D Viewer work
#15
(2020-01-22, 15:42)Magnus Forsberg Wrote: Did you see this phenomenon?

https://www.ldraw.org/cgi-bin/ptdetail.c...66ap01.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.
Reply
RE: 3D Viewer work
#16
(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?
Reply
RE: 3D Viewer work
#17
Still looks strange after reloading the page, looks like it does not like the NDIS/CHRD combo...

   
Reply
RE: 3D Viewer work
#18
(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.
Reply
RE: 3D Viewer work
#19
(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.
Reply
RE: 3D Viewer work
#20
(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
Reply
RE: 3D Viewer work
#21
(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
Reply
RE: 3D Viewer work
#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.
Reply
RE: 3D Viewer work
#23
(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.
Reply
RE: 3D Viewer work
#24
I'm not seeing any problems on any of my devices so this has got to be a stale cache issue.
Reply
RE: 3D Viewer work
#25
And today it looks like the problem is gone!!
Strange.
Reply
RE: 3D Viewer work
#26
(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!
Reply
RE: 3D Viewer work
#27
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.
Reply
RE: 3D Viewer work
#28
(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.
Reply
RE: 3D Viewer work
#29
(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.
Reply
RE: 3D Viewer work
#30
(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.
Reply
RE: 3D Viewer work
#31
(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
Reply
RE: 3D Viewer work
#32
(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.
Reply
RE: 3D Viewer work
#33
(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.
Reply
RE: 3D Viewer work
#34
(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.
Reply
RE: 3D Viewer work
#35
(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...%3DMinifig as an example. Do you think such a feature would be useful?
Reply
RE: 3D Viewer work
#36
(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...%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.
Reply
RE: 3D Viewer work
#37
Code worked great. Thanks again.
Reply
« Next Oldest | Next Newest »



Forum Jump:


Users browsing this thread: 1 Guest(s)