Is there a way to set a new zero point of the coordinate system? I made two panoramas of the same room, before and after tidying up. They can be switched by clicking a button, but as they unfortunately have different zero points, the camera looks into another direction after changing the panorama. Realigning them in my stitching program would be very exhausting.
Redefine coordinates?
-
-
Hi Dr. Schneckem,
Try setting a new view for your pano like this:
Changes the value of each attributes to match your needs and make the 2 panos looking at the same point...more info about the <view> node here: https://krpano.com/docu/xml/#view
SAlut.
-
Hello michel,
This doesn't work, as I want to have the same view after changing the pano wherever the camera has looked before. You may want to have a look at the pano: http://kacken.bplaced.net/test/test.html
I used KEEPVIEW as onclick attribute, but after switching the view is displaced about 90°, as the zero points don't agree. If I for instance could set the zero points to the upper left corner of the door, I had much less work than realigning both panos and make them match perfectly.
Thank you anyway :)
-
Erased... send it two times...
-
Hi Dr. Schneckem,
Ok.. You need something more complicate ... So, I am going to try with the following code and try to explain ..,
Code
Alles anzeigen<krpano version="1.0.8" onstart="action(onstart);" > <!-- text styles for startup info --> <textstyle name="infostyle" origin="top" edge="top" yoffset="10" textalign="center" background="false" border="false" fontsize="40" textcolor="0xFFFFFF" bold="false" effect="glow(0xFFFFFF,0.7,4,2);glow(0x000000,1,4,2);dropshadow(3,45,0x000000,2,0.6);" showtime="1.0" fadetime="1.0" /> <!-- start - load first scene --> <action name="onstart"> loadscene(scene1, null, MERGE); </action> <action name="loadsceneX"> add(hlookat_X,get(view.hlookat),%2); add(vlookat_X,get(view.vlookat),%3); set(fov_X,get(view.fov)); loadscene(%1, null, MERGE, BLEND(1)); lookat(get(hlookat_X),get(vlookat_X),get(fov_X)); </action> <style name="buttonstyle" url="%SWFPATH%/plugins/textfield.swf" children="false" width="120" height="22" css="p{color:#000000; font-family:Arial; font-weight:bold; font-size:14; margin-left:5; margin-right:5; text-align:center; }" backgroundcolor="0xFFFFFF" roundedge="5" shadow="1" borderwidth="0" glow="4" glowcolor="0xFFFFFF" visible="false" onover="tween(alpha,0.7,distance(0.3,0.2));" onout="tween(alpha,1.0,distance(0.3,0.2));" onloaded="set(alpha,0);set(textblur,15);set(blur,15); set(visible,true); tween(alpha,1,0.3); tween(textblur,0,0.3); tween(blur,0,0.3);" /> <!-- first scene/pano --> <scene name="scene1" onstart="showtext('[b][i]scene 1[/i][/b]', infostyle);"> <view hlookat="0" vlookat="0" fov="90" /> <image type="SPHERE"> <sphere url="garten.jpg" /> </image> <plugin name="button" keep="false" style="buttonstyle" html="[p]load scene 2[/p]" align="bottom" x="0" y="25" onclick="action(loadsceneX,scene2,127,0);" /> </scene> <!-- second scene/pano--> <scene name="scene2" onstart="showtext([b][i]scene 2[/i][/b], infostyle);"> <view hlookat="127" vlookat="0" fov="90" /> <image type="SPHERE"> <sphere url="garten1.jpg" /> </image> <plugin name="button" keep="false" style="buttonstyle" html="[p]load scene 1[/p]" align="bottom" x="0" y="25" onclick="action(loadsceneX,scene1,-127,0);" /> </scene> </krpano>
So, you have two panos of the same place but with an horizontal offset between them. (note: this can be corrected from your stitcher or your painter programs.. But let say you can not).
We must know the offset value to correct it, and when loading the next pano we must retrieve the actual view to be able to pass this view to the next pano...
The code above has 2 scenes.
Each scene call an action when onclick the button...
the action loadsceneX has 3 parameters to be passed: action(loadsceneX,%1,%2,%3);
%1 = the scene name to be loaded
%2 = the horizontal offset between the actual scene and the next scene
%3 = the vertical offset between the actual scene and the next scene (this is not needed in your example..but here it is..)
in your example, you have an horizontal offset of about 90º and no vertical offset...
so the action from the scene1 will be:
and the action from the scene2 will be:
Here is the action:Code<action name="loadsceneX"> add(hlookat_X,get(view.hlookat),%2); add(vlookat_X,get(view.vlookat),%3); set(fov_X,get(view.fov)); loadscene(%1, null, MERGE, BLEND(1)); lookat(get(hlookat_X),get(vlookat_X),get(fov_X)); </action>
What it do:
line 2: -- set a new variable hlookat_X to get the corrected value for the next hlookat... hlookat_X = actual horizontal view + horizontal offset);
line 3: -- set a new variable vlookat_X to get the corrected value for the next vlookat... vlookat_X = actual vertical view + vertical offset
line 4: -- set a new variable fov_X to get the actual fov... fov_X = actual fov view
line 5: -- Load the given scene name
line 6: -- look at the same view as beforeI have tried this way and it worked.
Hope this can help.SAlut.
-
Worked perfectly. Thank you very much.
Jetzt mitmachen!
Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!