Direct link to: Mobile demos
With the release of BS Contact iOS we address the needs of customers developing applications in industry areas such as:
- E-commerce
- E-learning
- E-government
- E-healthcare
In branches of Virtual Reality and Augmented Reality such as:
- CAD
- Visualization of simulation or measurement results
- Architecture
- Product visualization
BS Contact iOS adds significantly to the BS Contact product portfolio, bring the world of real-time 3D to the rapidly growing, technology-saavy market of handheld computing users.
The software is a stable and high performance visualization solution for handheld devices running the iOS ® operating system.
Please download the test version of BS Contact Mobile and the user's manual or check the systems requirements in the Download Center.
Release notes
BS Contact IOS
BS Contact supports Apple iOS Devices
Supported Devices
BSContact IOS requires OpenGL ES 2.0
OpenGL ES 1.1 is not supported .
iOS Version 4.2 or newer is required.
Device Compatibility
Graphics Platform
OpenGL ES 2.0
OpenGL ES 1.1
iPod Touch
PowerVR MBX
No
Yes
iPod Touch (Second Generation)
PowerVR MBX
No
Yes
iPod Touch (Third Generation)
PowerVR SGX
Yes
Yes
iPod Touch (Fourth Generation)
PowerVR SGX
Yes
Yes
iPhone
PowerVR MBX
No
Yes
Phone 3G
PowerVR MBX
No
Yes
iPhone 3GS
PowerVR SGX
Yes
Yes
iPhone 3GS (China)
PowerVR SGX
Yes
Yes
iPhone 4
PowerVR SGX
Yes
Yes
iPad Wi-FI
PowerVR SGX
Yes
Yes
iPad Wi-Fi+3G
PowerVR SGX
Yes
Yes
Launching BSContact iOS
Launching the BSContact App
A default scene embedded in the resources is loaded,
if the private Documents folder contains a file named main.wrl this file is
loaded. This file can be transfered via ITunes.
Launching via Safari or other applications
BSContact iOS registers the url protocol bscontact:
Entering an url into the safari url input field starting with bscontact: will launch
Anchor url links in the HTML code are working as well
specifying a file in the resouce directory of the app:bscontact:file.wrlfile in the documents directory of the app:
bscontact:documents:file.wrlurl to download : bscontact:documents:http://www.bitmanagement.de/developer/contact/examples/bmw/bmw_reflect.wrl
BSContact iOS registers the file extension wrl:
Files ending in .wrl will lauch BSContact. Because Safari downloads the file to the inbox folder in this case the base url is not available to resolve other url in the file.
Supported Textureformats
Image formats supported by the iOS UIImage class
Supported file formats Format Filename extensions
Tagged Image File Format (TIFF) .tiff, .tif
Joint Photographic Experts Group (JPEG) .jpg, .jpeg
Graphic Interchange Format (GIF) .gif
Portable Network Graphic (PNG) .png
Windows Bitmap Format (DIB) .bmp, .BMP
Windows Icon Format .ico
Windows Cursor .cur
XWindow bitmap .xbm
Note: Windows Bitmap Format (BMP) files that are formatted as RGB-565 are
converted to ARGB-1555 when they are loaded.
Image loaded via UIImage are top down, the texture coordinate in the shader need to be adapted :
texCoord = vec2(texCoordIn.x,1.0-texCoordIn.y);
PVR compressed textures
can be created with the Apple texturetool
convert Image.png into PVRTC using linear weights and 4 bpp, and saving as ImageL4.pvr user$ texturetool -e PVRTC --channel-weighting-linear --bits-per-pixel-4 -o ImageL4.pvr Image.png
For best performance
- use small textures
- use texture sizes which are power of 2, otherwise images are rescaled on loading use simple indexed facesets (only coordIndex, solid TRUE, creaseAngle 3.14)
- reuse appearance nodes
These are OpenGL ES 2 Limits on IOS Limits on IOS
-
The maximum 2D or cube map texture size is 2048 x 2048. This is also the maximum renderbuffer size and viewport size.
You can use up to 8 textures in a fragment shader. You cannot use texture lookups in a vertex shader.
You can use up to 16 vertex attributes.
You can use up to 8 varying vectors.
You can use up to 128 uniform vectors in a vertex shader and up to 64 uniform vectors in a fragment shader.
Contact emulates some basic VRML/X3D Appearance node with built-in shaders:
- unlighted material with or without texture
- lit material with a simple headlight with or without texture
Most applications should write their own GLSL 2 shaders if features like :
- different light sources like spot point lights
- multiple light sources
- multi-texturing
- texture transform
- texture coordinate generation
- vertex colors
- advanced lighting
- fog is needed
Node Support
BSContact iOS supports the full feature set including scripting of BSContact 7.2 except restrictions of special nodes requiring additional OS services.
Support for Medianodes
Sound Audioclip supports OpenAL
MovieTexture supports Animated GIF url download via HTTP and local caching is supported
Text is not supported beside the Text emulation via a user defined fixed character texture
Layer2D Layer3D is supported
CompositeTexture3D is supported
Inline is supported
Extensions for iOS
DeviceSensor node supports multitouch events
DeviceSensor event type strings:touchstart touchmove touchend touchcancelDeviceSensor eventType mask:
DeviceSensor { eventType "touch" }The Event nodes contains a new field
eventOut MFNode touchescontains 0 .. 10 Touch nodes
Definition of Touch node
Touch : NodeMetadata { SFInt32 type //!< type of event touchstart touchmove touchend touchcancel SFVec2f clientPosition //!< coordinates relative to the client window size SFVec2f clientPreviousPosition //!< previous coordinates relative to the client window size SFVec3f position //!< coordinate in relative screen space x/z -1 .. 1 SFVec3f previousPosition //!< previous coordinate in relative screen space x/z SFInt32 tapCount // number of taps } type: ITouchPhaseBegan = 0 // whenever a finger touches the surface. ITouchPhaseMoved, // whenever a finger moves on the surface. ITouchPhaseStationary, // whenever a finger is touching the surface but hasn't moved since the previous event. ITouchPhaseEnded, // whenever a finger leaves the surface. ITouchPhaseCancelled, // whenever a touch doesn't end but we need to stop tracking (
Shader Examples:
Simple Light + Texture:
Appearance { material Material { diffuseColor 1 0.2 0.2 } texture DEF earth-topo ImageTexture { url [ "earth-topo.png" ] } shaders DEF SHADER ComposedShader { language "GLSLES" # any needed parameters can be mapped to fields here field SFVec4f diffuseColor 1 1 1 1 #1 0.2 0.2 1 field SFVec4f emissiveColor 0 0 0 0 field SFNode texture USE earth-topo parts [ ShaderPart { type "VERTEX" url "glsl: uniform highp mat4 modelViewProjection; uniform mediump mat4 modelViewIT; attribute mediump vec4 position; attribute mediump vec3 normal; attribute mediump vec2 texCoord; uniform mediump vec4 diffuseColor; uniform mediump vec4 emissiveColor; varying mediump vec4 colorFrag; varying mediump vec2 texCoordFrag; void main(void) { gl_Position = modelViewProjection * position; vec3 normalView = normalize( vec3(modelViewIT * vec4(normal, 0.0))); vec3 lightDir=vec3(0,0,1); float NdotL = max(dot(normalView, lightDir), 0.0); colorFrag = NdotL * diffuseColor + emissiveColor; colorFrag.w = diffuseColor.w; texCoordFrag = texCoord.st; } " } ShaderPart { type "FRAGMENT" url "glsl: uniform sampler2D texture; varying mediump vec2 texCoordFrag; varying mediump vec4 colorFrag; void main(void) { gl_FragColor = colorFrag*texture2D(texture, texCoordFrag); } " } ] }
The following uniform parameters declared in a shader are automatically set by Contact:
For matrix parameters suffixes can be appended: the suffix I is for inverse, T for transpose, IT for inverse transpose
uniform parameter name | type | Description |
model with suffixes modelI,modelT,modelIT |
mat4 | model matrix = concatenated Transform (s) |
modelView | mat4 | model view matrix |
modelViewProjection | mat4 | model view projection matrix |
viewProjection | mat4 | view projection matrix |
view | mat4 | view matrix (from Viewpoint node) |
projection | mat4 | view projection matrix |
viewPosition, | vec3 | viewer position in world coordinates |
viewTarget | vec3 | |
viewUp | vec3 | |
viewDirection | vec3 | |
viewRight | vec3 | |
viewFovY | float | |
viewZRange | vec2 | |
viewportPixelSize | vec2 | |
time | float | |
lasttime | float | |
random | float | |
stereoPass | float | |
stereoMaxPass | float | |
transparent | float | hint that appearance is transparency sorted |
Fixed function pipeline emulation shaders | ||
texture | sampler | default texture |
texture0 .. texture7 | sampler | texture per unit |
TextureMatrix0 .. TextureMatrix7 | mat4 | texture matrix (fixed emulation) |
currentColor | vec4 | current color if Material is unlit |
ambientColor | vec4 | values from Material node |
diffuseColor | vec4 | a contains 1.0-transparency |
specularColor | vec4 | |
emissionColor,emissiveColor | vec4 | |
shininess | float | |
Material structure | struct MaterialParameters { mediump vec4 emission; mediump vec4 ambient; mediump vec4 diffuse; mediump vec4 specular; mediump float shininess; }; uniform MaterialParameters FrontMaterial; Parameters not needed can be omitted from struct MaterialParameters | |
Light support | ||
ambient | vec4 | global light ambient color |
LightSource Array | const int MaxLights=2; struct LightSourceParameters { mediump vec4 ambient; // Acli mediump vec4 diffuse; // Dcli mediump vec4 specular; // Scli mediump vec4 position; // Ppli mediump vec4 halfVector; // Derived: Hi mediump vec3 spotDirection; // Sdli mediump float spotExponent; // Srli mediump float spotCutoff; // Crli // (range: [0.0,90.0], 180.0) mediump float spotCosCutoff; // Derived: cos(Crli) // (range: [1.0,0.0],-1.0) //mediump float constantAttenuation; // K0 //mediump float linearAttenuation; // K1 //mediump float quadraticAttenuation;// K2 mediump vec3 attenuation; }; uniform LightSourceParameters LightSource[MaxLights]; Parameters not needed can be omitted from struct LightSourceParameters |
Porting glsl shaders there are no built-in uniform and attributes parameters. All required uniform matrices and vertex attributes need to be specified. gl_ModelViewProjectionMatrix
GL: gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; GLES: uniform highp mat4 modelViewProjection; attribute highp vec4 position; gl_Position = modelViewProjection * position; Normals: attribute mediump vec3 normal; uniform mediump mat4 modelViewIT; //viewspace normal N = normalize( vec3(modelViewIT * vec4(normal, 0.0)));; Texture coordinates: attribute mediump vec2 texCoord0; attribute mediump vec3 texCoord1; attribute mediump vec3 texCoord2; varying mediump vec2 TexCoord0; varying mediump vec3 TexCoord1; varying mediump vec3 TexCoord2; TexCoord0 = texCoord0; TexCoord1 = texCoord1; TexCoord2 = texCoord2;
BSContact iOS Developer Version
The developer version allows to embed a BSContact iOS OpenGL View into a custom app. The developer version is provided as an X-Code Project which is implementing a basic app in sourcode with an BSContact View. The core of the player is provided as library. This allows the developer to fully embed a high level 3D engine into any app. The ContactView provide functions for loading models from file/url, functions for changing navigation modes etc, delivering touch and guesture events. The developer can place the content in the app resource directory. Events from 3D to the application can be handled by a callback.
Detecting platform
Browser.getOption('product:platform')
possible values:IPHONE
IPHONE SIMULATOR
ANDROID
APPLE
UNIX
WIN32
WIN64
References
iOS:OpenGL ES Programming Guide for iOS
iOS::Best Practices for Shaders
iOS:Using texturetool to Compress Textures