Problems with some textures in XNA - xna

I have made a model using Sketchup, and have tested rendering it using Blender and it looks great.
However loading it in XNA has two problems.
1. One of the textures becomes see-thru not entierly transparent but items below on the inside of the model is visible (this is not the case in blender).
2. I have a rounded part on the model that is divided into smaller parts and the texture gets out of sync (the posisioning is all wrong).
I have tested exporting the model to 3ds and then use blender to save it as fbx (to eliminate any problems with Sketchup).
I have also tried using AutoDesks FBX Converter, same problems =(
I'm using myModel.Draw(World, View, Projection); to render the model.
Any suggestions?
/Jimmy

1)Sounds like a backface culling issue try this
device.RenderState.CullMode = CullMode.None; (try the CW and CCW variants)
also make sure the depth buffer is enabled
2) This may be similar problem to an issue I had with blender when you copy the bones try the gModel.CopyBoneTransformsTo(transforms); as well as gModel.CopyAbsoluteBoneTransformsTo(transforms);

Related

Placing objects below the ground in AR Quick Look on iOS

I am working on a project that will display objects below the ground using AR Quick Look. However, the AR mode seems to bring everything above the ground based on the bounding box of the objects in the scene.
I have tried using the USDZ directly and composing a simple scene in Reality Composer with the object or with a simple cube with the exact same result. AR preview mode in Reality Composer is showing the object below the ground or below an image anchor correctly. However, if I export the scene as a .reality file and open it in using AR Quick Look, it brings the object above the ground as well.
Is there a way to achieve showing an object below the detected horizontal plane or image (horizontal) using AR Quick Look?
This is still an issue a year later. I have submitted feedback to Apple. I suggest you do too. I have suggested adding a checkbox to keep Y axis persistent. My assumption is this behaves this way to prevent the object from colliding with the ground, but I don't think it's necessary. It's just a limitation right now.

Applying texture in Xcode Scene Editor is not working

I downloaded a 3D model(https://www.cgtrader.com/free-3d-models/industrial/machine/fuel-gas-scrubber-skid) and converted it to .dae using SketchUp.
I am not able to apply texture to this model in Xcode 9 Scene Editor. When i select any texture image(using materials->diffuse), it turns into black!!
I did the same for other models before and it was working fine. Not able to figure out what is the issue now.
I tried even changing the multiply, emission, reflective etc. properties to white color but still not able to see the texture.
I found what is wrong with the model. The model i downloaded is not UV mapped. That is why i am not able to apply the texture to it.

Strange rendering behavior with transparent texture in WebGL

I've been writing a little planet generator using Haxe + Away3D, and deploying to HTML5/WebGL. But I'm having a strange issue when rendering my clouds. I have the planet mesh, and then the clouds mesh slightly bigger in the same position.
I'm using a perlin noise function to generate the planetary features and the cloud formations, writing them to a bitmap and applying the bitmap as the texture. Now, strangely, when I deploy this to iOS or C++/OSX, it renders exactly how I wanted it to:
Now, when I deploy to WebGL, it generates an identical diffuse map, but renders as:
(The above was at a much lower resolution, due to how often I was reloading the page. The problem persisted at higher resolutions.)
The clouds are there, and the edges look alright, wispy and translucent. But the inside is opaque and seemingly being rendered differently (each pixel is the same color, only the alpha channel is changed)
I realize this is likely something to do with how the code is ultimately compiled/generated in haxe, but I'm hoping it's something simple like a render setting or blending mode I'm not setting. But since I'm not even sure exactly what is happening, I wouldn't know where to look.
Here's the diffuse map being produced. I overlaid it on red so the clouds would be viewable.
Bitmapdata.perlinNoise does not work on html5.
You should implement it by yourself, or you could use pre-rendered image.
public function perlinNoise (baseX:Float, baseY:Float, numOctaves:UInt, randomSeed:Int, stitch:Bool, fractalNoise:Bool, channelOptions:UInt = 7, grayScale:Bool = false, offsets:Array = null):Void {
openfl.Lib.notImplemented ("BitmapData.perlinNoise");
}
https://github.com/openfl/openfl/blob/c072a98a3c6699f4d334dacd783be947db9cf63a/openfl/display/BitmapData.hx
Also, WebGL-Inspector is very useful for debugging WebGL apps. Have you used it?
http://benvanik.github.io/WebGL-Inspector/
Well, then, did you upload that image from ByteArray?
Lime once allowed access ByteArray with array index operator, even though it shouldn't on js. This is fixed in the lastest version of Lime to avoid mistakes.
I used __get and __set method instead of [] to access a byte array.
Away3d itself might be the cause of this issue too, because the code of backend is generated from different source files depending on the target you use.
For example, byteArrayOffset parameter of Texture.uploadFromByteArray is supported on html5, but not on native.
If away3d is the cause of the problem, which part of the code is causing the problem? I'm not sure for now.
EDIT: I've also experienced a problem with OpenFL's latest WebGL backend. I think legacy OpenFL doesn't have this problem. OpenFL's sprite renderer was changing colorMask (and possibly other OpenGL render states) without my knowledge! This problem occured because my code and OpenFL's sprite renderer was actually using the same OpenGL context. I got rid of this problem by manually disabling OpenFL's sprite renderer.

Can a 3dsmax model be exported to include lighting effects?

I created a really basic cylinder, added a material and a glow effect
can I export a model to include the glow effect so the model will look like the rendering ?
http://imgur.com/VaNJLj4
Clarification:
Can I export the model to .fbx or .x and have it contain the lightning information so that if I import it into unity or xna the model will look like the rendering ?
"glowing" is really a post-process kind of effect. Actually a blur. There are quite a few tutorials on how to do this in XNA, but I doubt that you can easily export this from you modeling software (as in not possible at all).
The reason is that doing it usually requires setting up multiple rendertargets, custom shader, etc, which you will have to do yourself.
The reason you need multiple rendertargets;
When you render a model, only the pixels WITHIN the (visibly) outer vertices are processed by the pixel-shader. Hence, you can't render a smooth "fade-out" outside the model itself as would be the case in your picture.
What you usually do is you use a shader that renders your object normally, but also renders a "glow-color" to an other rendertarget.
When all models have finished rendering, you do a blur-effect on this second RT.
Then you blend your main RT with the blurred glow-RT.
This is VERY superficial, and I havent done it in AGES, so please DO check out some tutorials. Also, this bloom-sample basicly does the same thing, but on the entire scene, I think: http://xbox.create.msdn.com/en-US/education/catalog/sample/bloom
Add the glow in 3dsmax with filters, then it wil render automaticly.
Minor notice, 3dsmax is a very big program with lots of possibilities, just take your time finding everything out. Believe me it will take time.

When using a custom rigged and animated model with the XNA 4.0 Skinning example, why does the model animation become deformed?

[Image of the problem below]
The setup:
Xna 4.0
Modifying the project example at create.msdn.com/en-US/education/catalog/sample/skinned_model
A sample rigged and animated model of a woman from Mixamo in FBX format
The model is animating, but bones appear to be moving all over the place
I have verified that the model can animate as expected using the Autodesk Converter 2012.2. So it's not a model, bones or animation issue.
Is this a scale issue? Does a matrix need to be updated?
Full project (40MB) can be downloaded here.
I have tested out your project and the code is fine and works with my models. The problem you are having is in the model itself. Try to export it again, or use a different exporter. I suggest you try 'kw X-port'.

Resources