Why does an empty scene have 2k-5k polies?
Even the start template with the "ship" shows 2k-5k...
Well basically because the geometry contains all those polygons. Open the asset and see.
The Default Template does have not-empty scene if there's a SHIP model. It has a scene containing a 3D geometry and that geometry has 2.8K polygons (as well as 5.8K vertices).
Check it in the Inspector :
Related
I'm currently trying to combine the following sources:
Apples SceneKit Vehicle Demo, Resp. its Swift version,
ARKit by example, and resp. its Swift version.
Each project on its own works like a charm (although I changed the vehicle demo so that the car can be controlled by on-screen buttons).
Now, when I try to combine both projects to create an augmented reality racing game, I run into problems regarding the size of the .dae model of the car: it's too big.
I can scale the model using the (chassis) nodes .scale property, but as soon as I add the SCNPhysicsVehicle properties and behaviour, the car gets reset(?) to its original size. I tried to scale the model in Xcode (open dae file, change scale), but its bounding box remains the same - that tells me that the rescaling didn't work properly.
Any hints?
1)you can scale the dae models by art.scnassets directly.
art.scnassets -> car.dae -> node inspector -> transforms -> scale the object
2) can scale 3dmodel by SCNAction
let scene = SCNScene(named: "art.scnassets/cup.dae")!
let node = scene.rootNode.childNode(withName: "cup", recursively: true)!
let action = SCNAction.scale(by: sender.scale, duration: 1.0)
node.runAction(action)
What I like to do is use Blender or some other 3d modeling program to resize your dae model to work in meters. Everything in ARKit is based on meters, so by sticking to the same metric you can get all your models to play well together without having to guess what the scale factor needs to be.
I'm not sure how to fix the model directly in Xcode. However, you can fix it in blender. Start by importing the object into blender. Select the object and observe it's dimensions. Scale the object to the desired dimensions and apply them by hittin Ctrl + A, and selecting scale. Alternatively, from the object menu, you can select Apply -> Scale. Now you can export your model with the corrected size.
Please suggest me a solution for displaying annotations (text or images) for 3D model object on iOS.
For details, so far, I'm able to load and display an 3D model object on iOS by following the guide at http://iosdeveloperzone.com/2016/05/10/getting-started-with-modelio/. But I cannot find a way to add annotations, then display them with the 3D model object. I expect the implementation on iOS will be similar with https://sketchfab.com/models/363e92268ff04a6ba8322332004bdaab (on web version).
Thank you for any suggestions and answers.
Project the locations of your 3D locations into screen space. Then use the overlaySKScene to draw the annotations. This will get the annotations in the right spot, and keep the text a constant size, independent of the distance from the camera to each annotation's location.
You can try to create node with SCNText geometry type. This allows to show text in 3D scene.
In Ray Wenderlich's book about 3D game development using Scene Kit, the author sets the diffuse map of an object using the game scene editor in the Materials section under Properties. He instructs the reader to set this using a drop down, but I only get options that change the diffuse color and can't find how to add a map. I tried finding this option in Xcode and googling, but had no success.
How to enable this option in the editor itself? (I know I can set it with code.)
This can be done by finding the image in the Media Library and then dragging and dropping the image into the property.
My goal is to take an existing SKScene and stretch it according to a polynomial function, like one stretching everything toward or away from the center. The stretched form will be continuously rendered and presented to the user. It may be a new scene/image/view or whatever is necessary. The model will simply perform its functions over time in Euclidean form.
My project content is little more than the iOS SpriteKit starter project on Xcode.
I know of the functions in SKScene:
convertPointToView(), and
convertPointFromView()
However, I don't understand how these will be much use for the view since the scene only has aspect fill, fits and resize settings.
I attempted to make a fragment shader to do the actual stretching, however, I could not figure out how to get existing color and position information to draw the new color according to the transformation.
I am using SpriteKit and I only know how to access fragment from among the shaders using SKShader. I do not know how to access vertex shaders from this context. Otherwise, I would have tried to use a vertex shader.
You could go with SceneKit:
Create SCNView with SCNScene
Create SCNNode with SCNPlane geometry (or create custom SCNGeometry)
Create SCNMaterial with your SKScene attached to created material's diffuse.contents property
Attach material to geometry
Attach node to scene
Then you have multiple choices:
Use SCNShadable - either attach shader modifier for geometry or material, or use custom SCNProgram.
Use SCNTechnique on SCNView.
This way you will have your SKScene as texture on a 3D object (plane or something) and have full control of vertex and fragment shaders.
Is it possible to add a textured material to an object with a custom mesh in Three.js?
Whenever I try exporting an object from Blender to Three.js with a texture on it, the object disappears. Looking through the three.js examples, it seems like they've carefully avoided putting textures on anything other than the built-in geometries, and forcing a texture on such a mesh causes it to again disappear.
For example, if I edit scene_test.js, which is a scene file called from webgl_scene_test.html, if I apply the "textured_bg" to the "walt" head, it will disappear.
It looks like the missing piece of the puzzle was that you have to apply the set of UV coordinates to the mesh of the object in question.
First, select your texture, and under "Mapping" make sure that the "coordinates" dropdown is set to "UV"
Then, click on the "object data" button, and in the UV Texture list, click the plus icon. This seems to automatically add the UV data to the mesh.