Sie sind nicht angemeldet.

1

Mittwoch, 30. November 2022, 23:49

3D model room labels

Wondering about how to go about adding the scene title as a room label on the 3D model? Placed dead centre in each scene...

Ideally visible in "floorplan" view i.e. directly overhead looking straight down at the centre of the model (useful to have this as a standard feature - like Matterport does)

Example image attached

Suggestions welcome !
»GeoK« hat folgendes Bild angehängt:
  • flooplanview.jpg

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »GeoK« (1. Dezember 2022, 13:50)


kme

Fortgeschrittener

Beiträge: 310

Wohnort: Belgium

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

  • Nachricht senden

2

Mittwoch, 21. Dezember 2022, 01:09

In my virtual gallery (Virtual Gallery Thread), I have some hotspots on the floor. It is defined using style and later dynamically generated.
The style is as follows:

Quellcode

1
2
3
4
5
<krpano>
  <hotspot name="middle" style="htsp" type="image" url="pixel-blue.png" width="330" height="580" scale="0.5" distorted="true" depth="0" tx="0" ty="-2" tz="0" rx="90" torigin="True" zorder="2" depthbuffer="true" capture="false" alpha="0" />
  <hotspot name="south" style="htsp" type="image" url="pixel-blue.png" width="1188" height="580" scale="0.5" distorted="true" depth="0" tx="0" ty="-2" tz="-600" rx="90" torigin="True" zorder="2" depthbuffer="true" capture="false" alpha="0" />
  <hotspot name="north" style="htsp" type="image" url="pixel-blue.png" width="1188" height="580" scale="0.5" distorted="true" depth="0" tx="0" ty="-2" tz="600" rx="90" torigin="True" zorder="2" depthbuffer="true" capture="false" alpha="0" />
</krpano>


I altered the code a bit to generate labels on these hotspots. I call these actions when clicking the "dollhouse" and "reset view" buttons to show/hide the labels:

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
	<action name="showlabels"  scope="local" >
		for(set(i,0), i LT hotspot.count, inc(i),
			if (hotspot[get(i)].style == "htsp",
				copy(st, hotspot[get(i)]);
				addhotspot(calc('label-' + (i+1)), hs);
				set(hs.css, calc("color: white; text-shadow: 2px 2px 4px #000000; font-family:fantasy; font-size: 40px; "));
				set(hs.style,label);
				set(hs.type,text);
				set(hs.keep,true);
				set(hs.html,calc(""+st.name));
				set(hs.height,50);
				set(hs.width,150);
				set(hs.scale,1);
				copy(hs.tx, st.tx);
				copy(hs.ty, st.ty);
				copy(hs.tz, st.tz);		
				set(hs.rx, 360);		
				set(hs.ry, -90);		
				set(hs.rz, -90);		
				set(hs.distorted,true);
				set(hs.torigin,world);
				set(hs.depth,0);
				set(hs.zorder,2);
				set(hs.depthbuffer,true);
				set(hs.rotate,0.0);
				set(hs.capture,false);
				set(hs.bgalpha,0);
				set(hs.blendmode,normal);
				set(hs.smoothing,true);
				set(hs.txtshadow, calc("1 1 2 0x000000 1"));
				set(hs.mergedalpha, false);		
				set(hs.rz, -90);		
				trace(hs.name);
			);				
		);
	</action>
	
	<action name="hidelabels"  scope="local" >
		for(set(i,0), i LT hotspot.count, inc(i),
			if (hotspot[get(i)].style == "label",
				copy(st, hotspot[get(i)]);
				set(st.height,0);
				set(st.width,0);
			);				
		);
	</action>


It gives the following result (see attachment).

Hope you can use it as a basis for your own project!

If you have further questions, dont hesitate to ask...

K.
»kme« hat folgendes Bild angehängt:
  • showlabels.jpg

3

Mittwoch, 21. Dezember 2022, 16:02

Thanks for sharing, will take a look. *thumbsup*