Jump to content
  • Advertisement
Sign in to follow this  
BoulderSean

[.net] Strange effect when trying to texture a 3D mesh

This topic is 3660 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I apologize ahead of time if I am asking some fairly noob questions in this post. I am a fairly able coder but I have only been playing with 3D for a little over a week. While I have a fair amount of C# experience, I have not done much with WPF/Avalon so figured I'd whack something up as a project. This isn't really game related, more just a 3D/WPF learning experience. As such, I wasn't sure whether to post this in the .NET section or the DirectX/XNA section since WPF is backed by DX. Anyway, ultimately, I am trying to replicate some functionality similar to Poser or DAZ Studio to see what I can accomplish. Basically, that means reading a Poser format CR2 file, parsing a Wavefront obj file and then attempting to texture it correctly, apply morphs and perhaps weld groups to a bone structure as defined in the CR2. That last bit may take a while but should be good fun :) So I've written an obj parser. It initially handled v/vt/vn/f and seemed to work ok for a first go: As a first try not to bad but I realized that if I was going to texture from a UV map I'd have to parse g/usemtl into individual meshes to apply the correct files/materials to the right places: Still looking good. Then I tried this new grouping ability on a figure: Oops. Very sharp. I soon realized not all obj files have normals. When I had done it before as one mesh WPF had actually, behind the scenes, calculated the normals for me. So I had to learn how to calculate normals and weight them properly across all meshes: That was much better. Time to texture it: Now it was looking right! So I tried another: What a mess. The texture map was shifted on the Y axis by a smudge. I spent a couple days trying to figure that out. I finally realized that the earlier models I used were using texture maps with a nice 1:1 aspect ratio. This texture map is 3:4. I changed the ImageBrush I was using for the DiffuseMaterial to use Stretch.Fill rather than UniformToFill. Well and good: So the Y shift is now gone. However, I am still going nuts trying to figure out what is causing the blue banding. There is no cyan/blue on the texture map. Rather it seems like it is pulling the coord from outside the bounds of the map? Or something else? I am really not sure. For a closer look here's a couple links to higher res views: front view of banding rotated/side view of banding I then tried another model, this is a newer version from DAZ, it's texture maps are 1:1. It became even worse... instead of just banding, it was hatched with the blue stuff. This is actually the same figure as the very first sans clothes/hair: horrible hatching Does anyone have any suggestions as to the possible cause of this?

Share this post


Link to post
Share on other sites
Advertisement
How did you solve it? Because others might be having the same problem, and by providing your solution, you could prevent them from posting a new question and instantly provide them with the solution. :)

Toolmaker

Share this post


Link to post
Share on other sites
It was actually the textures themselves. They were very high resolution. 3000+pixels. I now check the dimensions when I load a texture and scale the BitmapImage using DecodePixelWidth/Height as needed.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!