This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > VRML > January 2005 > Is it possible to do this in VRML?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Is it possible to do this in VRML?
Andrew Bullock

2004-12-27, 11:15 pm

Hi,

I want to have a flat map of the world then when i click it, make it
wrap itself around an invisible 3d sphere, thus making a textured globe.

is this possible, if so, how?


Thanks

Andrew
mdk

2004-12-28, 7:14 am

Dnia 2004-12-28 01:00, Użytkownik Andrew Bullock napisał:
> Hi,
>
> I want to have a flat map of the world then when i click it, make it
> wrap itself around an invisible 3d sphere, thus making a textured globe.
>
> is this possible, if so, how?


Yes, it is possible however it's not very easy.

Some way of doing it can be to map your texture on
a flat IndexedFaceSet - this IFS should have a form of
a grid like NxM faces.
After clicking this IFS (use TouchSensor for detecting it)
you can animate all vertices of this IFS so that they form vertices
of a sphere (use CoordinateInterpolator for this).

It can be easily implemented in VRML but you should use some
program to calculate starting and ending positions for those vertices.

Bye
md
mdk

2004-12-28, 12:17 pm

>> I want to have a flat map of the world then when i click it, make it
>
>
> Yes, it is possible however it's not very easy.
>
> Some way of doing it can be to map your texture on
> a flat IndexedFaceSet - this IFS should have a form of
> a grid like NxM faces.
> After clicking this IFS (use TouchSensor for detecting it)
> you can animate all vertices of this IFS so that they form vertices
> of a sphere (use CoordinateInterpolator for this).


Well, actually I was curious myself what it would look like so I
wrote it:

http://atos.wmid.amu.edu.pl/~d115738/index.php

I think it's quite a nice effect :)

Bye
md
Joerg Scheurich aka MUFTI

2004-12-28, 12:17 pm

>>> I want to have a flat map of the world then when i click it, make it[color=darkred]
[color=darkred]
[color=darkred]

There is also a simpler way from flat map to sphere by "pumping up" a
SuperShape proto sphere 8-)

Reduce uTesselation/vTesselation if your machine is not fast enough....

#VRML V2.0 utf8

EXTERNPROTO SuperShape[
exposedField SFFloat ua
exposedField SFFloat ub
exposedField SFFloat um
exposedField SFFloat un1
exposedField SFFloat un2
exposedField SFFloat un3
exposedField SFFloat va
exposedField SFFloat vb
exposedField SFFloat vm
exposedField SFFloat vn1
exposedField SFFloat vn2
exposedField SFFloat vn3
exposedField SFFloat border
field SFFloat creaseAngle
field SFNode texCoord
exposedField SFInt32 uTessellation
exposedField SFInt32 vTessellation
]
[
# "SuperShapePROTO.wrl"
"/usr/freeware/share/dune/SuperShapePROTO.wrl"
"http://www.csv.ica.uni-stuttgart.de/vrml/dune/docs/scriptedNodes/SuperShapePROTO.wrl"
]


Transform
{
children
[
Shape
{
appearance Appearance
{
material Material
{
}
}
geometry DEF SuperShape1 SuperShape
{
ub 0.01
um 4
vm 4
uTessellation 24
vTessellation 24
}
}
]
}

DEF TimeSensor1 TimeSensor
{
cycleInterval 20
}

DEF ScalarInterpolator1 ScalarInterpolator
{
key
[
0
1
]
keyValue
[
0.01
1
]
}

ROUTE TimeSensor1.fraction_changed TO ScalarInterpolator1.set_fraction
ROUTE ScalarInterpolator1.value_changed TO SuperShape1.set_ub

DEF ScalarInterpolator2 ScalarInterpolator
{
key
[
0
1
]
keyValue
[
4
0
]
}

ROUTE TimeSensor1.fraction_changed TO ScalarInterpolator2.set_fraction
ROUTE ScalarInterpolator2.value_changed TO SuperShape1.set_um

DEF ScalarInterpolator3 ScalarInterpolator
{
key
[
0
1
]
keyValue
[
4
0
]
}

ROUTE TimeSensor1.fraction_changed TO ScalarInterpolator3.set_fraction
ROUTE ScalarInterpolator3.value_changed TO SuperShape1.set_vm

Viewpoint
{
orientation 0.157384 -0.595703 0.787634 1.583949
position -1.175203 -1.582090 1.538572
}

DEF TouchSensor1 TouchSensor
{
}

ROUTE TouchSensor1.touchTime TO TimeSensor1.set_startTime
Andrew Bullock

2004-12-28, 11:15 pm

<snip>

Thankyou both for your excellent solutions, i never expected something
so helpful!

I have one question for you Joerg, How do i now apply a texture to the
surface? I cannot seem to get it to work.

Thankyou very much

Andrew
Andrew Bullock

2004-12-28, 11:15 pm

Andrew Bullock wrote:
> <snip>
>
> Thankyou both for your excellent solutions, i never expected something
> so helpful!
>
> I have one question for you Joerg, How do i now apply a texture to the
> surface? I cannot seem to get it to work.
>
> Thankyou very much
>
> Andrew



Sorry, was being an idiot.

Fixed it.

Thanks alot guys!

Andrew
psi

2004-12-29, 12:19 pm


Andrew Bullock wrote:
> Hi,
>
> I want to have a flat map of the world then when i click it, make it
> wrap itself around an invisible 3d sphere, thus making a textured

globe.
>
> is this possible, if so, how?
>
>
> Thanks
>
> Andrew


you could also try this,

expand the sphere and shrink the texture at the same time,

what's below works in cortona using a preprietary 2d interpolator (
unfortunately missing the form vrml spec.)

you'll also need a gif image with a see-through border.

simon.



DEF st Transform {
translation 0 0 6
children [

Shape {
geometry Sphere {
radius 1
}

appearance Appearance {
material Material {
ambientIntensity 1
diffuseColor 0.8 0.8 0.8
transparency 1
}
texture ImageTexture {
repeatS FALSE
repeatT FALSE
url ["http://vrml.portland.co.uk/x3dwithseethroughborder.gif"]
}
textureTransform DEF stt TextureTransform {
scale 1 1
center -.5 -.5
}}}
]}

DEF t1 TimeSensor {cycleInterval 3 loop TRUE }

EXTERNPROTO Position2InterpolatorEx [
eventIn SFFloat set_fraction
exposedField MFFloat key
exposedField MFVec2f keyValue
exposedField MFFloat params
exposedField SFString type
eventOut SFVec2f value_changed
]
[

"http://www.parallelgraphics.com/vrml/proto/Cortona/extensions.wrl#Position2InterpolatorEx"
]



DEF tectInt Position2InterpolatorEx {
key [0,.5,1]
keyValue [1 1,10 10,1 1]
}

DEF radInt PositionInterpolator {
key [0,.5,1]
keyValue [1 1 1, 3 3 3,1 1 1]
}

ROUTE t1.fraction_changed TO tectInt.set_fraction
ROUTE t1.fraction_changed TO radInt.set_fraction
ROUTE radInt.value_changed TO st.scale
ROUTE tectInt.value_changed TO stt.scale

Joerg Scheurich aka MUFTI

2004-12-29, 12:19 pm

> what's below works in cortona using a preprietary 2d interpolator (
> unfortunately missing the form vrml spec.)


Why is this a preprietary 2d interpolator ?
It is simply a PROTO of a PROTO with a script inside the file

http://www.parallelgraphics.com/vrm.../extensions.wrl

If it would be a preprietary extension, it would have a URN according to

http://www.web3d.org/x3d/specificat...nsions.html#F.3

Or is the word "preprietary" used in a legal sense ? Do parallel graphics
forbid the usage of

http://www.parallelgraphics.com/vrm.../extensions.wrl

in other projects/with other browsers ?

so long
MUFTI
--
Microsoft Visual SourceSafe
? Adding more than 150 files is not recommended.
Windows may fail to add all selected files. Continue ?
Yes No Help
Cindy Ballreich

2004-12-29, 7:17 pm

psi wrote:
>
> you could also try this,
>
> expand the sphere and shrink the texture at the same time,
>
> what's below works in cortona using a preprietary 2d interpolator (
> unfortunately missing the form vrml spec.)
>
> you'll also need a gif image with a see-through border.
>
> simon.


I would recommend placing the mapped IndexedFaceSet (used for the
CoordinateInterpolator) and a mapped Sphere under a Switch. When the
interpolator is complete, switch the geometry. This will eliminate any
ugly seam or coincident vertex problems with the texture.

Damn, it's been a long time since I've done this...

Cindy

--
The email address above is a spam trap. Don't expect a response.
Reach me using firstname at lastname dot net
psi

2004-12-29, 11:15 pm

are you aware that the Cortona extensions file only contains code for
Position2Interpolator, all the other nodes are simply place holders to
stop other browsers reporting an error, things don't actually work,
except in the Cortona browser with the correct URN.

I guess you just assumed all the code was there, so did i, but then
none of this is controlled by a standard, so there's actually no
requirement for anything except basic compliance, hence proprietary.

but even if all the code was there and compliant, the interface isn't
standardised, names and function could be changed without notice, so
you really need to copy the code, in which case its not an extension.
simon.

Andrew Bullock

2004-12-30, 7:20 pm

<snip>

Thankyou both for your excellent solutions, i never expected something
so helpful!

I have one question for you Joerg, How do i now apply a texture to the
surface? I cannot seem to get it to work.

Thankyou very much

Andrew
mdk

2005-01-01, 7:14 am

Dnia 2004-12-28 01:00, Użytkownik Andrew Bullock napisał:
> Hi,
>
> I want to have a flat map of the world then when i click it, make it
> wrap itself around an invisible 3d sphere, thus making a textured globe.
>
> is this possible, if so, how?


Yes, it is possible however it's not very easy.

Some way of doing it can be to map your texture on
a flat IndexedFaceSet - this IFS should have a form of
a grid like NxM faces.
After clicking this IFS (use TouchSensor for detecting it)
you can animate all vertices of this IFS so that they form vertices
of a sphere (use CoordinateInterpolator for this).

It can be easily implemented in VRML but you should use some
program to calculate starting and ending positions for those vertices.

Bye
md
Cindy Ballreich

2005-01-04, 4:15 am

psi wrote:
>
> you could also try this,
>
> expand the sphere and shrink the texture at the same time,
>
> what's below works in cortona using a preprietary 2d interpolator (
> unfortunately missing the form vrml spec.)
>
> you'll also need a gif image with a see-through border.
>
> simon.


I would recommend placing the mapped IndexedFaceSet (used for the
CoordinateInterpolator) and a mapped Sphere under a Switch. When the
interpolator is complete, switch the geometry. This will eliminate any
ugly seam or coincident vertex problems with the texture.

Damn, it's been a long time since I've done this...

Cindy

--
The email address above is a spam trap. Don't expect a response.
Reach me using firstname at lastname dot net
Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews