Sie sind nicht angemeldet.

kme

Fortgeschrittener

  • »kme« ist der Autor dieses Themas

Beiträge: 310

Wohnort: Belgium

Beruf: Long time coder, product manager and 3D enthousiast

  • Nachricht senden

1

Freitag, 24. Februar 2023, 11:34

onloadcomplete event when loading 3D model textures through mtl file vs texurl

I notice a difference in the way the "onloadcomplete" event is triggered.

When using this code, the onloadcomplete is triggered after the preview.png is loaded.

Quellcode

1
2
3
4
5
	<scene name="lowres" autoload="true" title="hello">
		<image>
			<depthmap url="model.obj" texurl="preview.png" subdiv="0" rendermode="3dmodel" hittest="true" scale="100" textured="true" waitforload="true" center="0,0,0" axis="+x+y+z"/> 
		</image>		
	</scene>


When using mtl file to load textures (by leaving out the texurl parameter), the event is fired as soon as the model is loaded but the textures for that model are still loading and not completed.

My questions:
1) is this intended
2) if so, is there an event that we can use that fires when the model textures from the MTL file are done loading?

Thank you!
K.

2

Freitag, 24. Februar 2023, 13:58

Hi,

with mtl the onloadcomplete will fire when all textures are loaded - and in all my tests it does so...

When not in your case, please provide your example.

Best regards,
Klaus

kme

Fortgeschrittener

  • »kme« ist der Autor dieses Themas

Beiträge: 310

Wohnort: Belgium

Beruf: Long time coder, product manager and 3D enthousiast

  • Nachricht senden

3

Freitag, 24. Februar 2023, 14:53

Thanks for the quick reply!

An example can be viewed here:

https://krpano.kri-soft.be/examples/onloadcompleted/

I use my browser debug tools to disable caching and put a network throttle on it to simulate slow loading of images, like this.
As a result, the "alert" is shown even before any material from the MTL is fetched/loaded.

The images in the MTL are pretty big, so maybe it will show the problem without even doing the throttling (still need to disable or clear cache tho).

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »kme« (24. Februar 2023, 15:21)


kme

Fortgeschrittener

  • »kme« ist der Autor dieses Themas

Beiträge: 310

Wohnort: Belgium

Beruf: Long time coder, product manager and 3D enthousiast

  • Nachricht senden

4

Freitag, 24. Februar 2023, 14:57

If you take a close look at the "debug" image, you can even see that the MTL file is not even loaded yet. This means no materials could have been loaded, yet the alert is shown (which is in the onloadcomplete event).

5

Freitag, 24. Februar 2023, 16:46

Thanks for the example!
I was able to reproduce it now and right it was related to the .mtl file loading and when it takes too long.
Will be fixed in the next release.

kme

Fortgeschrittener

  • »kme« ist der Autor dieses Themas

Beiträge: 310

Wohnort: Belgium

Beruf: Long time coder, product manager and 3D enthousiast

  • Nachricht senden

6

Freitag, 24. Februar 2023, 17:21

*thumbsup* *thumbup* *thumbsup*

kme

Fortgeschrittener

  • »kme« ist der Autor dieses Themas

Beiträge: 310

Wohnort: Belgium

Beruf: Long time coder, product manager and 3D enthousiast

  • Nachricht senden

7

Freitag, 24. März 2023, 22:01

Hi Klaus,

This is now working in build
INFO: krpano 1.21 (build 2023-03-21)

But I still found a potential issue with this: when I have a preview defined, for example this:

Quellcode

1
	<preview type="grid()" />


Then the onloadcomplete is triggered BEFORE all materials have been downloaded.

When I dont define this in the tour, the event is triggered AFTER all materials have been downloaded (as expected).

Demo:
Without preview (alert shows after materials are downloaded):
https://krpano.kri-soft.be/examples/onloadcompleted2/

With preview (and alert shows almost immediately) (note: disable cache or you can't really notice it)
https://krpano.kri-soft.be/examples/onlo…th_preview.html

Seems more like the behaviour of onpreviewcomplete?

gr,
KME

8

Dienstag, 1. August 2023, 04:21

If you take a close look at the "debug" image, you can even see that the MTL file is not even loaded yet. This means no materials could have been loaded, yet the alert is shown (which is in the onloadcomplete event).
Metoo. I'm using Multiple Textures with MTL file but its does not loading. Have u solve problem yet?

9

Donnerstag, 3. August 2023, 09:30

Loading 3d obj with mtl.
What should I do when the load is complete and the onload complete doesn't work?

<depthmap url="obj.obj" onloadcomplete="trace('1'); ..... ... />

Beiträge: 1 117

Wohnort: Poland, Europe

Beruf: krpano developer : virtual tours : the cms4vr owner

  • Nachricht senden

10

Donnerstag, 3. August 2023, 10:19

Hi

In depthmap scenes I use onblendcomplete


Piotr
Your own professional, online cloud tool for creating virtual tours - www.cms4vr.com

facebook page :: youtube :: wiki.cms4vr.com

cms4vr team *thumbsup*

Beiträge: 141

Wohnort: Russia, Komi republic, Uhta

Beruf: developer

  • Nachricht senden

11

Donnerstag, 3. August 2023, 15:59

I use this design:

Quellcode

1
2
callwhen(image.loadstate == 3 || image.loadstate == 5,
	... some code, when texture image loading is complete);

and it works very accurately when all model images are loaded *cool*

Hello from uhta3d )))
I'm in telegram: Lastromantik