Fitting textures..

General discussion and questions about XNALara go here.

Moderators: ObscureMemories, Runa, Love2Raid

Post Reply
User avatar
Taira2032
Posts: 9
Joined: Thu Apr 09, 2020 1:05 pm
Custom Rank: Ipsissima

Fitting textures..

Post by Taira2032 »

First, let me say for a couple of months now Ive made myself a challenge to see how far I can go with extreme meshmodding using only Xnalara. No Blender, 3ds, Daz or any other mediate program whatsoever.

Then, recently i found this tool, and its pretty neat for merging meshes, very nice, clean work it does. Now, the newly merged meshes of course produce one render group and one texture. So lets say for a body but different model for 1 hand, it will do left and right hand but the texture wont fit right on the new merged hands meshes. Ok, I can always splat a grid of numbers on the diffuse map and just edit and fix and mix and match in photoshop until it fits. Not that I mind, I have time but.. still there should be some way to 'combine' the textures too. I mean manually, jist take things from one nd put them in different place on the other, yk.
So.. is there a way to see how a texture (the diffuse maps) is mapped on a mesh? (again, only XNA, no blenders or whatever)? Lol I suck at explaining :XD: :XD: I tried exporting those UV map thingies but I think that concerns the meshes rather than what goes where on the texture.
I vaguely remember my mom was doing some Scene Immerse when she was playing TES Morrowind and modding but that was ages ago haha. So, hAlp? :3
Image
User avatar
XNAaraL
XPS Author
Posts: 120
Joined: Fri Sep 21, 2012 9:01 am

Re: Fitting textures..

Post by XNAaraL »

What about "Modify-->Save UV Face Layout"
Image
?

Image
UV map over diffuse map


And about "merging meshes" ... what about:
Combining two models with XPS
User avatar
Taira2032
Posts: 9
Joined: Thu Apr 09, 2020 1:05 pm
Custom Rank: Ipsissima

Re: Fitting textures..

Post by Taira2032 »

Thank you :3 ! Yep, it is UV maps but I meant changing that layout itself. I'm afraid what I meant would be technically impossibe. It would be like one mesh using several diffuse maps.. So I guess I should just keep meshes separate and go like layers. I just wanted to keep the model lighter for loading. At least those parts where textures aren't overlapping, I can merge them and edit them together, have less meshes and .png-s and all with the model.

For combing parts, that's the first thing I learned in XNA from such tutorials years ago haha, I meant editing the meshes themselves, not just model parts. Let's say I want to swap an arm but from the elbow down only. So far the only I've found is tricking it with transparency- get both models' diffuse textures in photoshop, cut out and save with a transparent hole. Visually, it works great but the physical mesh is still there.
In short, I'm trying to find a way how to combine in a clean model: i.e. model A but with textures of model B and the bones/rig of model C. Seemed like asking my computer to do something super basic ahaha but as it turns out, it's soooo not XD
Image
User avatar
XNAaraL
XPS Author
Posts: 120
Joined: Fri Sep 21, 2012 9:01 am

Re: "Fitting textures" is the same like "remove vertices" ?

Post by XNAaraL »

Confused

Taira2032 wrote:Thank you :3 ! Yep, it is UV maps but I meant changing that layout itself. I'm afraid what I meant would be technically impossibe. It would be like one mesh using several diffuse maps.. So I guess I should just keep meshes separate and go like layers. I just wanted to keep the model lighter for loading. At least those parts where textures aren't overlapping, I can merge them and edit them together, have less meshes and .png-s and all with the model.

For combing parts, that's the first thing I learned in XNA from such tutorials years ago haha, I meant editing the meshes themselves, not just model parts. Let's say I want to swap an arm but from the elbow down only. So far the only I've found is tricking it with transparency- get both models' diffuse textures in photoshop, cut out and save with a transparent hole. Visually, it works great but the physical mesh is still there.
In short, I'm trying to find a way how to combine in a clean model: i.e. model A but with textures of model B and the bones/rig of model C. Seemed like asking my computer to do something super basic ahaha but as it turns out, it's soooo not XD
Why should it be technically impossibe having one mesh using several diffuse maps ???
Image
Just test it, it works.

But I give up trying to understand you. Your choice of words cannot be found in my technical dictionary.
Incomprehensible terms such as:
  • keep meshes separate and go like layers (keep meshes separate ???) .... (like layers)
  • keep the model lighter for loading
  • where textures aren't overlapping (overlapping textures? Really?)
  • I can merge them (textures!) and edit them together, have less meshes (meshes ???)and .png-s and all with the model. (Just saying, I am really surprised that nobody use Photoshop to blend the diffuse texture and the lightmap, using blend mode multiply ... that is was every shader do)
  • For "combing" parts, that's the first thing I learned in XNA from such tutorials years ago haha (haha ... you should change your teacher), I meant editing the meshes themselves, not just model parts. (the meshes themselves, not just model parts ??? lol)
  • ...
  • ...
  • Seemed like asking my computer to do something super basic ahaha but as it turns out, it's soooo not (so ... 3D mesh editin is "super basic easy"?)
  • ...
confused
"it is UV maps but I meant changing that layout itself." ... (sorry, nothing related to the UV layout here ... just 2D texture editing and 3D remove vertices / faces ... nothing about "having one mesh using several diffuse maps" there)
confused

BTW 1:
to find a way how to combine in a clean model: i.e. model A but with textures of model B and the bones/rig of model C.
Change your teacher!
BTW 2:
In short, I'm trying to find a way how to combine in a clean model: i.e. model A but with textures of model B and the bones/rig of model C. Seemed like asking my computer to do something super basic ahaha but as it turns out, it's soooo not
Exactly that was the first MOD for XNALara released 14-03-2009, 14:35 , made by Dusan using only XNALara (at this time, there was no Blender or 3ds max importer / exporter with bone support available.)
2.8 -- release 021
- use Shift left mouse drag to pan camera
- controllable light direction and intensity
- new models: Diver captain (the mercenary), AK rifle
- updated Doppelganger: now has teeth
https://www.tombraiderforums.com/showpo ... count=4657
The "teeth" mesh was from the XNALara v 1.0 lara_jungle_shorts model, the other meshes was from the XNALara v 1.85 doppelganger model

BTW 3:
Let's say I want to swap an arm but from the elbow down only. ... Visually, it works great but the physical mesh is still there.
The first "user made MOD" was 26-04-2009, 11:00, made by XNAaraL (yes that is Me, Myself & I) "lara_ jungle_shorts nogear" https://www.tombraiderforums.com/showpo ... count=9884
Some parts of the metal "gear" mesh had must still exist, like the the metals on the boots .... other mesh parts must be removed, like the the buckle from the backpack. So it was modify the 3D mesh ... by removing vertices (the UV coords are part of the vertex description) and removing faces.
All this was made by myself in only XNALara / XPS (at this time labeled "XNA Lara | araL").
At this time, there was no Blender or 3ds max importer / exporter with bone support available ... no mesh.ascii format known .... no Generic_Item.mesh format developed (by myself) ... all models "hard coded" inside XNALara ...
Dusan wrote:
Phoenix5000 wrote:Hello Dusan! At you very interesting program. If you will not complicate, remove please gear from all models Lara ` s or write in detail as it can be made. To you I shall be very grateful. Excuse for my English, I Russian.
I'm afraid you can't do that yourself.
The .mesh format is not a standard format, it is my own, there's no publicly available tool to edit them.

Even if you removed the gear, there would still remain shadows on Lara's clothes. These would have to be removed from the corresponding lightmaps (textures) manually in Photoshop etc. and it's close to impossible for some outfits since you'd have to recreate large portions of the lightmaps, including subtle details of the clothes.
https://www.tombraiderforums.com/showpo ... count=9469

Yes we can do it "yourself" :X
Why should it be technically impossibe (for you) ... this days ... if it was possibe 11 years ago (for me) ???
It is all a matter of creativity (and ignoring dumb teachers)
User avatar
Taira2032
Posts: 9
Joined: Thu Apr 09, 2020 1:05 pm
Custom Rank: Ipsissima

Re: Fitting textures..

Post by Taira2032 »

Ok ok I understand, why so angry lol sheesh ._. I'm not a professional and I'm a self-taught hobbyist, and a WYSIWYG person so apologies I couldn't put it into the correct terminology. Tried to explain my logic and would be much easier if I was actually showing what I'm trying to do..

But anyhow, from how you put it, I think I mean removing/changing vertices and faces. Removing/reparenting bones would be nice too. And I meant in the XNA interface; if it needs the good ol' coding on notepad, now that's an entirely different story.

Theres something about bones I would ask but I think I've already annoyed the hell out of you so.. :silent: lol
Image
User avatar
XNAaraL
XPS Author
Posts: 120
Joined: Fri Sep 21, 2012 9:01 am

Re: Fitting textures..

Post by XNAaraL »

I am not "angry". it's just my temperament and passion (and the lack of knowledge of english language) :pi:

True, it would be much easier if you was actually showing what you trying to do :idea: (show me the goal ... not your "presumed" way).

Removing/changing vertices and faces in the XPS (XNA is a framework by Microsoft) interface is not so easy. I recomment to use a 3D editor like Blender. True, I had use coding on notepad ... even it was more edit the "Commands-->Import / Export script" XNALara_XPS\scripts\XpsImportExportScript.cs ... something like "

Code: Select all

if (pos.Y > 1.6) { pos.Y = 1.6; }
"

Removing bones in the XPS interface is possible. Just select the bone and press Ctrl+h

Reparenting bones, you can do using this tool: https://www.deviantart.com/zareef/journ ... -539369755
v1.8
- Added "Parenting bones" function. You can now link two or more bones without an external 3D editor.
You can try the same tool to removing/changig vertices and faces
- Mesh data:
This tab only displays the vertices and faces data of the selected mesh. You can edit them directly from the related text box if you know what you are doing. Changes will be saved when you click "Save changes" button or when you do one of the operations that autosave the data (such as changing RG of several meshes).
But I know that you know this :mrgreen: haha
https://www.youtube.com/watch?feature=y ... pp=desktop
But the way I did it now is ok for me for the things I need to do with bones and meshes and I got accustomed to using it like that so apologies for the drama
What you want to ask about bones?
(BTW: You know the XNALara armature requirements ?)
User avatar
XNAaraL
XPS Author
Posts: 120
Joined: Fri Sep 21, 2012 9:01 am

Re: Fitting textures..

Post by XNAaraL »

Taira2032 wrote:...
(part 1)
Then, recently i found this tool, and its pretty neat for merging meshes ..

Now, the newly merged meshes of course produce one render group and one texture.
...
Ok, I can always splat a grid of numbers on the diffuse map and just edit and fix and mix and match in photoshop until it fits.
...
...
(part 2)
So.. is there a way to see how a texture (the diffuse maps) is mapped on a mesh?. ..
...
I tried exporting those UV map thingies but I think that concerns the meshes rather than what goes where on the texture.
...
XNAaraL wrote:...
True, it would be much easier if you was actually showing what you trying to do :idea: (show me the goal ... not your "presumed" way).
...
Since you haven't describe what your goal is, I have to use my crystal ball and guess it (something I hate very much).

But first a few notes:
I have never used Zareef's tool. So I don't know if it makes his job good or bad.

I know that this tools allow to merge meshes, but "merging meshes" is a completely useless function in my opinion. That is why this option is not available in XPS. Merging models has an advantage (all parts can be loaded at once), but merging meshes has no advantage, only disadvantages. So why would anyone want to do it? Confused.
--- A merged mesh dont needs less memory than two meshes
--- A merged mesh will not be rendered faster than two meshes
--- Tell me just one advantage. I don't know of any advantage
--- Merged meshes of course can only have one render group (shader). That's a disadvantage

However, if the function to merge meshes is well done, then the UV map and textures shouldn't be a problem. Such a function (albeit useless) is easy to implement.

Part 1
Suppose you have a model that contains two meshes. The eyebrows and the eyelashes:
Image
Each mesh has his own uv-map (part of the vertex description) and a texture (image):

eyelash
Image

eyebrow
Image

Now we merge both parts (both meshes have textures with a resolution 512x512 pixel)
+++ The x (u) coordinate from the first mesh (eyelash) will be divided by 2 (u = x1 / 2.0)
+++ The x (u) coordinate from the second mesh (eyebrow) will be divided by 2 and added by 0.5 (u = x2 / 2.0 + 0.5)
+++ The textures from both meshes a combined (first texture left ... second texture on the right side) x = x1 ; x = x2 / image2x_resolution * image1x_resolution + image1x_resolution
Result (resolution 512x1024
Image
+++ Textures should be powers of two because many older graphical cards still require it. The reason for that restriction was so that they could perform some optimizations to the texture mapping operations. Most modern graphic cards don't have this restriction either.
+++ So we rescale the texture:
Image

Ok, there is no needs to splat a grid of numbers on the diffuse map and just edit and fix and mix and match in photoshop until it fits.
If the tool works good, there is nothing to do:
Image


Part 2
"So.. is there a way to see how a texture (the diffuse maps) is mapped on a mesh?."
Yes.
"Modify-->Save UV Face Layout"
...
"I tried exporting those UV map thingies but I think that concerns the meshes rather than what goes where on the texture."
Wrong.
Blender 3D: Noob to Pro/UV Map Basics - Wikibooks, open books
UV mapping is a technique used to "wrap" a 2D image texture onto a 3D mesh. "U" and "V" are the names of the axes of a plane, since "X", "Y" and "Z" are used for the coordinates in the 3D space.
UV mapping
UV mapping is the 3D modelling process of projecting a 2D image to a 3D model's surface for texture mapping. The letters "U" and "V" denote the axes of the 2D texture because "X", "Y", and "Z" are already used to denote the axes of the 3D object in model space, while "W" (in addition to XYZ) is used in calculating quaternion rotations, a common operation in computer graphics.
Textures
In order to map a texture to the triangle we need to tell each vertex of the triangle which part of the texture it corresponds to. Each vertex should thus have a texture coordinate associated with them that specifies what part of the texture image to sample from.
Texture coordinates range from 0 to 1 in the x and y axis (remember that we use 2D texture images). Retrieving the texture color using texture coordinates is called sampling.
In OpenGL, texture coordinates start at (0,0) for the lower left corner of a texture image to (1,1) for the upper right corner of a texture image.
In DirectX (XPS use DirectX) texture coordinates start at (0,0) for the upper left corner of a texture image to (1,1) for the lower right corner of a texture image.

Image
User avatar
Taira2032
Posts: 9
Joined: Thu Apr 09, 2020 1:05 pm
Custom Rank: Ipsissima

Re: Fitting textures..

Post by Taira2032 »

I don't ike merging meshes either.. I'm not after making the model ighter or aiming at size/graphics. Merging meshes for me was because of this (bless that guy for formuating the question muuuch better than me ahahah..)
https://xnalara.forumotion.com/t283-rig ... th-xnalara
can I import 2 models into XPS and swap the skeleton (the bones) from one to another? For example: import a model of Lara and remove the bones from it (if it has them). Then import a model of one of the characters from Left 4 Dead 2, for example Rochelle, and remove the mesh but keep the bones. And then fit Rochelle's bones into Lara's model... in short perform a simple re-rigging. Is that possible to do with your program?
and then--
XNAaraL wrote: "merging meshes" is a completely useless function in my opinion. That is why this option is not available in XPS. Merging models has an advantage (all parts can be loaded at once), but merging meshes has no advantage, only disadvantages. So why would anyone want to do it?

Merged meshes of course can only have one render group (shader). That's a disadvantage
Um sometimes its the only way I can make a model have the exact same properties of another. Even if I manually edit all the parameters, materials, etc like from another model, sometimes it doesnt want to look the same way. but if I merge the meshes with zareef's tool, the destination model 'inherits' it. Like, I did want on purpose to have one render group. Like what "flatten image" in photoshop does to layers lol.

Back to bones, so my logic was that if I merge the meshes, it would merge and transplant the bones as well. Like how when you save as generic item but also merging dupicates and adding bones that are missing. So that's why I got so obsessed with merging meshes.
Then it rose my question that I would like to keep the textures in one pic, but on one model the, let's say, eye is in the upper left corner but I want the part merged with another model that has an entirely different texture where the eye is in the bottom center.. And exporting the UVs, they just overlap with no way to separate them (i.e. to use your example for example- would look like this https://sta.sh/0123gm2e1j5v )
so I need to figure out where the new eye should be on the png so it fits both.. HUGE thanks for explaining me because it seems it depends on the coordinates. So at least with textures I can do what I want lol.
Tbh actualy I think what I need to understand is render groups and having nothing to do with the meshes and bones. Now I see that it's an entirely different concept so my bad, I admit, I couldn't be more wrong haha.

One last question.. https://www.deviantart.com/grummel83/ar ... -620553955
Why sometimes the attached part's bones are dead after I save after add-to step? I have a head, fully rigged and working, I attach to neck upper on another body model but sometimes after I do the add to thing, only the bone where it atached works and all the bones of the head dont move anymore, although the bone tree is still there. Sometimes they work, other times they become dead, although I do the exact same procedure. What am I doing wrong..? 'object reference not set to an instance of an object" and "index was outside the bounds of the array" have almost become meme sentences to me LOL
Image
Post Reply