gdkchan / Ohana3DS-Rebirth

WIP new version of Ohana3DS in C#.
176 stars 40 forks source link

Texture colour errors... #21

Closed Blayer98 closed 3 years ago

Blayer98 commented 8 years ago

image

It appears that this character has some issues in regards to colours.

For example, they don't match the texture sheet colours, for example, the character's eyes are blue instead of white and the eye texture isn't there, but it does appear when you put on "Always show first texture". Another issue is that the hair colour should be red, and not black, although the texture shows up black, it's shown as red in the game. His jacket is green instead of red, and there's shading on his top that shouldn't be there, including the bottom of his jeans.

Here's a screenshot for comparison.

image

Blayer98 commented 8 years ago

Also, with another version of the character, there's no shading on the top which is good, but the jacket is still green, and the skin texture appears green, which is really odd.

image

Blayer98 commented 8 years ago

image image

Fragment Shader makes the textures even worse... :( Well, at least the hair isn't black. :)

Blayer98 commented 8 years ago

Oh, this also happens with another and quite a few characters. image

There's green all over the texures which make them look terrible. That green is NOT on any texture sheet.

gdkchan commented 8 years ago

The Detective Pikachu issue... Well, those colors are actually diffuse vertex colors, and not part of the texture (that's why you see them even if you remove all textures). The game have custom texture blending stages to blend those colors and textures together, to create different effects on the 3DS GPU. It can use up to 6 stages, and combine colors from texture 1/2/3, vertex color, shading and more. Those weird vertex colors are probably used as input on the fragment shader stage to create some neat effect, but on Ohana3DS this doesn't happens.

Heres what happens on Ohana3DS: It completely ignores all those blending stages and commands. It will use the first texture "texture 1" (when Always use first texture is selected), or use the lastest available texture if "Use last texture when present" is selected. For examble, if you have just 1 texture, it would be texture 1, if you have two, if would be texture 2 and so on. The vertex diffuse color is used straight aswell, I think that DX multiplies the vertex color with the texture color by default.

On a attempt to simulate what is done on the 3ds GPU, and getting more accurate views, I wrote a Fragment Shader to blend the textures/colors like the 3ds does. It is still incomplete, but works on most cases from what I saw. Unfortunately, it just doesn't work on most GPUs. I don't know why but I think that Managed DX is to blame. On your case, the fragment shader wasn't executed, that's why the textures disappeared for you when you enabled it.

If your intention is exporting the model, there isn't much I can do to make it come out right. Without a fragment shader, there isn't any way to make it exactly like it shows on the 3ds. But a easy solution when exporting is deleting all vertex colors on your 3D software, it will probably look OK if you do that.

For future reference, this issue is probably connected to the problem with the Codename S.T.E.A.M characters, but the csteam problem is even worse since the model is mostly transparent.

Edit: Also related to issue #19.

Blayer98 commented 8 years ago

Oh, interesting. Where exactly would I find the vertex shaders? Do you know what they would be referenced as?

gdkchan commented 8 years ago

Not sure about what you mean, but the fragment shader stuff is inside the bch itself. It's right after the strings table.

If you're asking about the fragment shader I wrote for Ohana3ds, it's inside "Ohana3DS Rebirth\Resources\OFragmentShader.txt".

Blayer98 commented 8 years ago

Ah, sorry! I wasn't clear enough... I meant the vertex colours which you could remove with a 3D software apparently. I'm using Blender, so it's probably more difficult. :P

Why does Ohana3DS not use the shader commands? And when using the Fragment Shader, exporting shows the same blue covered texture less model, which can't be helped I guess.

gdkchan commented 8 years ago

It does not use the shader commands, because your GPU isn't a 3DS GPU basically. They works differently. The only way to make the PC GPU behave similar to the 3DS GPU is with a fragment shader program like I said before.

About the color issue, just export your model as SMD format (SMD doesn't support vertex colors, so they will be discarded), after you export it as .smd, you can use the Noesis tool to convert it to any format you want (such as .fbx or *.dae).

Blayer98 commented 8 years ago

Oh cool! Although, will .smd keep the armatures? Since I'd like to animate without having to go through the trouble of re-constructing the bones again.

gdkchan commented 8 years ago

yes, it will keep the skeleton and the rigging...

Demonslayerx8 commented 8 years ago

That model loads almost perfectly for me with fragment shader enabled, cause pretty much i have a AMD GPU, and everything nintendo (consols and their shaders) run on a AMD GPU, but ya, SMD does keep the skeleton and rigging.

dp tim

Blayer98 commented 8 years ago

Oh ok, how come yours is black? And the textures on your side don't seem to be visible...

Demonslayerx8 commented 8 years ago

oh they're pretty visable to me, but they're not black at all, u can see the texture better if u zoom in, plus my pic was of the higher poly model of Tim, but here's a pic of the lower poly version dp tim2

Blayer98 commented 8 years ago

Hmm, I've also noticed the textures are misplaced on both high and middle models :/

image

image

not sure what's causing it...

EDIT: Sorry, those models were AFTER I exported both models to .SMD format.

Demonslayerx8 commented 8 years ago

That's normal, that just means that the materials needs to have the textures set to Mirror

as for the eyes, idk bout that, i didnt bother fixing them on my end.

Blayer98 commented 8 years ago

Fixed most UV mapping apart from the head and hair textures, which I'm not sure why it does that... Yeah, I fixed most of them with Flip UVs. :P image image

Blayer98 commented 8 years ago

Oh interesting, both are having issues with the hair texture... You have to use the last texture when present to fix the hair, and I'm not sure about the right eye being black/alpha when that should be his skin :P

image

Demonslayerx8 commented 8 years ago

Cause nintendo models like using either Clamp or Mirror for their uv's.. i guess it save filespace or something like that :/

Blayer98 commented 8 years ago

The 3DS has low VRAM apparently, so maybe that's it.

Demonslayerx8 commented 8 years ago

naaah, they used that setting ever since the N64 days, even up to the WiiU, they used the same thing.

Blayer98 commented 8 years ago

ahh ,ok.

Oh wow... Exporting with Noesis doesn't capture the textures for some reason, so Materials will appear as black, and textures will appear as white... :/

image

image

I'm surprised if I'm the only one having issues with this :P Of course I can't get Cinema4D or anything other than 3DS Max and Maya as a college student license.

robotortoise commented 8 years ago

This seems to be related to this issue.

I'm getting the same textures-not-being-mapped when exporting-as-external model issue as well as you are.

I'm on an Nvidia graphics card. I assume that's the problem, as it seems other people with Nvidia GPUs are having similar issues.

Maybe it's something to do with how Nividia drivers interact with the software vs. how AMD drivers work? Or not? I don't know, I'm not a coder.

Anyways, would you like me to close my issue, as this seems to be related?