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.

jeromebg

Professional

  • "jeromebg" started this thread

Posts: 803

Location: Angers - France

Occupation: Photographer

  • Send private message

1

Thursday, September 26th 2019, 11:28am

lookto with offset

Hi,
I'm trying to lookto hotspot when clicked but not centered in the screen...
Here is an exemple : http://360images.fr/barebonelookto/

Works fine when hotspot has ath="0" but it doesn't when ath is different.
Plus I would like to look to the offset position directly without having to look first at the centered position and then calculate the offset coordinates with screentosphere.

Don't know if it's possible, well I guess it is with some math but I'm very bad with math...

Any clue ?

Here is my actual code :

Source code

1
2
3
4
5
6
7
8
9
<style name="hsstyle" url="hs.png" onclick="lookto_offset(get(name))"/>
	
<action name="lookto_offset">
lookto(get(hotspot[%1].ath), get(hotspot[%1].atv), get(hotspot[%1].tofov), smooth(50,50,50),true,true,
calc(hpix,stagewidth * 0.25);calc(vpix,stageheight * 0.5);screentosphere(hpix, vpix, toh, tov);lookto(get(toh),get(tov),get(view.fov),smooth(50,50,50));
);
</action>
	
<hotspot name="hs1" style="hsstyle" ath="0" atv="0" tofov="20"/>

Alexey Tkachenko

Professional

Posts: 760

Location: Sevastopol, Crimea, Russian Federation

Occupation: Interpreting, Building virtual tours

  • Send private message

2

Thursday, September 26th 2019, 12:43pm

Hi)

I tried calculating offsets, but it seems I'm lacking some deeper understanding of calculations between 3D space of the pano and screen plane.

Source code

1
<action name="lookto_offset" >		showlog();		calc(hpix,stagewidth * 0.25);		calc(vpix,stageheight * 0.5);		spheretoscreen(hotspot[%1].ath,hotspot[%1].atv, x,y);		screentosphere(hpix, vpix, toh, tov);				set(screen_distance, calc((3 * hpix) - x));		trace('screen_distance == ' , screen_distance);				set(spherical_distance, calc(hotspot[%1].ath - toh));		trace('sp dist == ' , spherical_distance);				set(fov_difference, calc(hotspot[%1].tofov / view.fov));		trace('fov diff == ' , fov_difference);				set(target, calc(hotspot[%1].ath - (spherical_distance * fov_difference)));		trace(target);		lookto(calc(hotspot[%1].ath - (spherical_distance * fov_difference)), calc(hotspot[%1].atv), get(hotspot[%1].tofov), smooth(50,50,50),true,true);	</action>




Obviously, the current FOV and target FOV of the hotspot must be taken into consideration.
Regards,

Alexey

jeromebg

Professional

  • "jeromebg" started this thread

Posts: 803

Location: Angers - France

Occupation: Photographer

  • Send private message

3

Thursday, September 26th 2019, 2:27pm

Thx for trying Alexey !

jeromebg

Professional

  • "jeromebg" started this thread

Posts: 803

Location: Angers - France

Occupation: Photographer

  • Send private message

4

Thursday, September 26th 2019, 2:59pm

Another approach would be (with fovtype="hfov") :

Source code

1
2
3
<action name="lookto_offset">
lookto(calc(hotspot[%1].ath - (hotspot[%1].tofov / 4)),get(hotspot[%1].atv),get(hotspot[%1].tofov),smooth(50,50,50));
</action>

but it's still not precise...

jeromebg

Professional

  • "jeromebg" started this thread

Posts: 803

Location: Angers - France

Occupation: Photographer

  • Send private message

5

Friday, September 27th 2019, 1:47pm

Hi Klaus, no clue on this one ?

jeromebg

Professional

  • "jeromebg" started this thread

Posts: 803

Location: Angers - France

Occupation: Photographer

  • Send private message

6

Friday, November 29th 2019, 9:15am

Hi again,
Still not a single small idea from anybody on this one ?