Sie sind nicht angemeldet.

Lieber Besucher, herzlich willkommen bei: krpano.com Forum. Falls dies Ihr erster Besuch auf dieser Seite ist, lesen Sie sich bitte die Hilfe durch. Dort wird Ihnen die Bedienung dieser Seite näher erläutert. Darüber hinaus sollten Sie sich registrieren, um alle Funktionen dieser Seite nutzen zu können. Benutzen Sie das Registrierungsformular, um sich zu registrieren oder informieren Sie sich ausführlich über den Registrierungsvorgang. Falls Sie sich bereits zu einem früheren Zeitpunkt registriert haben, können Sie sich hier anmelden.

1

Freitag, 24. November 2017, 17:27

Trying to control the distortion (width / height) of a distorted hotspot image around the edges of the screen

Hi All,

My head hurts - I can't figure it out - please help!

I am trying to create an animated line which highlights a specific item within the 360 image when a hotspot image / icon is activated or hovered over.

I want this to also work in WebVR so I am using a hotspot image .png which is just 1 colour solid pixels and therefore can be any width or height and can show as a line or block by using the rotate variable.

I have it working, but due to the 360 distortion, when it is around the edges of the screen the width (or height as I have rotated it) of the line becomes large - I want to try and keep the width constant, regardless of where it is in the current view i.e. keep the width the same regardless of its position on the screen.

The line hotspot needs to be distorted="true" so that when used with zoom="true" it will accurately point to the object or item in the 360 scene, regardless of its location in the current view.

I have it working but because it is a distorted hotspot (for accurate positioning when zooming in etc) when it is positioned to the left or right of the screen i.e. at the edges, the width / height becomes very distorted - see attached images.

Here is the current project: http://wearereality.com/dev/clients/malt…0.46,132.11,0,0);

Apologies if my code is a bit messy, the bits in question are as follows:

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
<style name="hotspot-style-line"

type="image"
     	renderer="webgl"
     	visible="true"
     	enabled="true"
     	handcursor="false"
     	zorder="4"
     	zorder2="0.0"
     	capture="false"
     	edge="left"
     	ox="0"
     	oy="0"
     	zoom="true"
     	distorted="true" rx="0.0" ry="0.0" rz="0.0"
     	depth="1000"
     	tx="0.0" ty="0.0" tz="0.0"
     	flying="0.0"
     	scaleflying="true"
     	alpha="1.0"
     	
     	novrspot="yes"
     	
/>

<hotspot name="linespot1" url="images/line.png" onloaded="if(device.touch,set(width,100));" height="3" width="0" rotate="270" ath="-70" atv="15" onclick="" 
style="hotspot-style-line"/>


<action name="linetween">
set(hotspot[%1].alpha,1);
set(hotspot[%1].width,1);
tween(hotspot[%1].width,%2,0.5);
</action>


I want to control that distortion by dynamically changing the width of the line hotspot image to counter the 360 distortion. Is there a way to do this or a calculation which will counter the 360 distortion of the image? Similarly, is there a way to create distortion based on the zoom level / current FOV? Because as the user zooms in, the width of this line should also increase to make it appear the same width regardless of FOV.

I have tried a few hacks, calculating the difference between the current ath and the hotspot ath and then adding / subtracting from the width - but I can't figure out how to do this accurately / dynamically? The solution needs to take into account the velocity / acceleration of the distortion as the image gets closer to the edges of the current view.

Here are my unsuccessful hacks (unsuccessful because they aren't dynamic):

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
<!-- this is a way of hacking the width 
<action name="linetween">
set(hotspot[%1].alpha,1);
set(hotspot[%1].width,1);
set(currentFOV,get(view.fov));

set(currentATH,get(view.ath));
set(hsATH,get(hotspot[%1].ath));

dist(d,currentATH,hsATH);

sub(newheight1,3,get(d));

set(hotspot[%1].height,get(newheight1));
tween(hotspot[%1].width,%2,0.5);
</action>

<action name="abs">
	if (%1 LT 0,
		sub(%1,0,get(%1));
	);
</action>
<action name="dist">
	sub(xdiff,%3,%2);
	abs(xdiff);
	div(totaldiff,xdiff,100);
	sub(%1,1,totaldiff);
</action>
-->


I hope this makes sense? Thanks in advance for any help.
»Alexander360« hat folgende Bilder angehängt:
  • Screen Shot 2017-11-24 at 16.08.26.jpg
  • Screen Shot 2017-11-24 at 16.08.43.jpg

2

Dienstag, 28. November 2017, 20:37

Hi,

I'm not fully sure what you mean, but in the next release (1.19-pr14) there will be a more natural rendering for distorted=false hotspots in VR.

Normally such hotspots are rendered as always-screen-orientated flat surfaces, but in a VR headsets this feels/looks wrong.
In the next release these hotspots will be rendered as 'non-zoomed-distorted' hotspots in VR. Then the 'effect' would be the same as distorted=false hotspots on a normal screen.

Best regards,
Klaus