You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Wednesday, November 30th 2022, 11:49pm

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 has attached the following image:
  • flooplanview.jpg

This post has been edited 1 times, last edit by "GeoK" (Dec 1st 2022, 1:50pm)


kme

Intermediate

Posts: 309

Location: Belgium

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

  • Send private message

2

Wednesday, December 21st 2022, 1:09am

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:

Source code

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:

Source code

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 has attached the following image:
  • showlabels.jpg

3

Wednesday, December 21st 2022, 4:02pm

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