www.tombraiderforums.com  

Go Back   www.tombraiderforums.com > Tomb Raider Level Editor and Modding > Tomb Raider Level Editor > Software Development

Reply
 
Thread Tools
Old 04-01-20, 11:30   #251
LoreRaider
Archaeologist
 
LoreRaider's Avatar
 
Join Date: Jul 2016
Location: Italy
Posts: 1,695
Default

I've tried yesterday this new trick to convert UV mapped models to fake UV and it works flawlessly, so thank you so much for that
Now, I have a little problem, I'm converting some good old Silent Hill 1 objects, and they don't use that big quality for textures, so exporting the texture page as 128x128 it's fine already, the problem is that when I import the texture page on TextureAdd, it resizes that page to 256x256 and the .rec file with all the infos about textures placement takes the infos for 256x256 sized page as well, is there a way to keep it 128x128?
__________________
"Everybody lies, no exceptions."
LoreRaider is offline   Reply With Quote
Old 05-01-20, 03:12   #252
sapper
Archaeologist
 
sapper's Avatar
 
Join Date: Sep 2007
Posts: 1,680
Default

Can you import the texture using Strpix? I can't remember. textureadd is only necessary for the .rec.

Yes the .rec assumes 256 x 256 I will have to see if I can change script for 128 x 128.
__________________
Check trsearch\Tools for some of my programs
sapper is offline   Reply With Quote
Old 05-01-20, 10:36   #253
LoreRaider
Archaeologist
 
LoreRaider's Avatar
 
Join Date: Jul 2016
Location: Italy
Posts: 1,695
Default

Yes I can of course
And thanks for looking at that
__________________
"Everybody lies, no exceptions."
LoreRaider is offline   Reply With Quote
Old 05-01-20, 12:20   #254
sapper
Archaeologist
 
sapper's Avatar
 
Join Date: Sep 2007
Posts: 1,680
Default

There is a way to import in TextureAdd.

Select page 1.

Delete the page in the "Texture Pages" section

In "Texture Pieces" section click add new and load image

My modified script will assume 128 x 128 texture is in top left corner of page 1.

Then import .rec file in "Texture Position" section

Updated script will be posted soon.

EDIT:

Updated plugin here https://github.com/sapper-trle/sappe...eases/tag/v2.4

You can uninstall my current addon and install the new one

or

if you know where the plugin is installed, just copy __init__.py over old copy.

Addon installed at "C:\Users\Username\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\sappers-TRLE-addons\__init__.py" on my PC.

In .rec export file dialog look for "128 x 128 image" checkbox in options. Check the option to scale the UVs to 128 x 128 image instead of default 256 x 256.

Note I didn't test with a model so let me know if it doesn't work.
__________________
Check trsearch\Tools for some of my programs

Last edited by sapper; 06-01-20 at 04:16.
sapper is offline   Reply With Quote
Old 06-03-20, 01:11   #255
adngel
Historian
 
adngel's Avatar
 
Join Date: Jan 2004
Location: Surrey
Posts: 311
Default

Hi there.

I've tried the 128x128 and yes, it worked for me.

I had to make a texture of 256x256 in Photoshop, and put the 128x128 texture in the top-left corner to can import it in "TextureAdd", otherwise the 128x128 was being stretched to 256 when I import it in there.

But the .rec was correct, even with the wrong texture, I could see the rectangles were the right size.


However, I'm having troubles with an issue, after add the mesh and the texture, I can't open the wad in Wad merger (1.98 beta 4) It says there is a problem with the obj, I can open the mesh but no the textures (not for the 256 nor the 128).



Generally, I'm worried for the optimization, in case of Lara's outfit or humanoid character, 256px per mesh could consume too many textures, this 128 will help to reduce, although I think that even 64 would help too (thinking in small things like hands and feets).

Also, I am baking only half of the mesh, to generate less textures, (and texturing manually the other half, because otherwise, they appear with a default color texture).

Even yet, I think this is definitely a huge help. (I still remember that Anaya in Von Croy slot, where I was making the textures quad, triangle, by triangle in photoshop... at least this clearly reduce effort (only had to make the eyes, but for the rest, it looks nice).





Edit: solved the issue with the wad merger. It was because in Blender, the half of the mesh that I wasn't projecting, was using a UV map that were not made of square shapes, what I did to fix it is:

- After doing the quads UV and the projection, I duplicated the object
- Then in the original one, I deleted the repeated faces (that I didn't use in the projection)
- In the duplicated one, , I aplied the mirror X, and removed all the faces except the repeated faces (that were the ones missing).
- After it, join both meshes, merge vertices by distance and recalculate normals.

The result, is that the repeated faces, will be using now a triangle UV like the projected faces, but reusing the same texture. And in this way, yes, I can reimport the model in Wad merger and combine it with other wads without more problems.
__________________
Living and Left :)

Last edited by adngel; 06-03-20 at 13:37.
adngel is offline   Reply With Quote
Old 06-03-20, 14:25   #256
TRJTA
Professor
 
TRJTA's Avatar
 
Join Date: Sep 2007
Location: The Netherlands
Posts: 3,156
Default

I am trying to do this, but I seriously can't even get Blender to show a material/texture properly from a downloaded model. It just shows up as pink in the material tab and when I render an image, while it does show the texture under the texture tab. Like seriously how hard can this be? I'm just opening a downloaded file. Can someone help me?
TRJTA is offline   Reply With Quote
Old 06-03-20, 16:26   #257
adngel
Historian
 
adngel's Avatar
 
Join Date: Jan 2004
Location: Surrey
Posts: 311
Default

Quote:
Originally Posted by TRJTA View Post
I am trying to do this, but I seriously can't even get Blender to show a material/texture properly from a downloaded model. It just shows up as pink in the material tab and when I render an image, while it does show the texture under the texture tab. Like seriously how hard can this be? I'm just opening a downloaded file. Can someone help me?
The purple colour is because the textures are not correctly set in the material. (Maybe if you downloaded the model, it has the materials right but is looking for the textures in a different folder).

If you are going to render an image in blender, you surelly will have to set the material there properly, but for this TRLE method, don't need bother so much. Just 1 material with 1 texture. (no specular, normals, AO, displacements, nor nothing like that).


I attach a screenshot of my blender (version 2.8, the previous ones have a different UI), it's a 1920x1080 size so I leave just the link.

https://sta.sh/0ify8z3iv67


That's the "Shading" workspace, you can select it in the top bar. (Layout, UV Editing and Shading use to be the ones used in this method).

In shading, at right, you must select your mesh, and in the "Material Properties" (the right menu, the tab that is like a red ball near the bottom of the tabs) . There you can set the materials that your mesh is going to use.

Many models (specially modern ones), may use multiple materials, but for this method there must be only 1, maybe you may have to separate head and body, or make more complex editions (if head and hair are different materials, you will need to change UVs and combine textures... so what I said, more complex XD).

But ideally, there must be 1 material, in the Material properties, at the top, there is the list of materials, if this is empty, press the plus button ("+") and then "New" button. That will make the material graph appear.

If there are more than 1 material, remove all the others with the button minus ("-"), leave just one, when there is only 1, all the model gets it.



In the Graph editor (the scheme at the lower half), you can drag your texture from the windows explorer, on the Blender desktop, it will make appear a node that you can connect to the "Base Color" entry.

With that, you should be able to see the material. Ensure that you are in texture or render view (in the 3d window, at top right, there are like 4 balls, one is for wireframe view, solid view, texture view and render view).
__________________
Living and Left :)
adngel is offline   Reply With Quote
Old 07-03-20, 23:58   #258
adngel
Historian
 
adngel's Avatar
 
Join Date: Jan 2004
Location: Surrey
Posts: 311
Default

Ok, forget my previous complaint about the outcome texture sizes, after keep practicing, I see that I actually have control of the textures sizes modifying the UV mapping so I can generate smaller textures.

Therefore 256 and 128 are actually quite enough for the purpose. After that, I just can praise for what wonderful finding and the good work in the plugins that makes it possible, thank you very much, (despite being some years late @_@) but definitely I think this could be my new standard method whenever I need to make any TRLE object.



Also, the problem with the wad that gets corrupted, unabling to open it back in wad merger, I could asociate it with the use of "Lara Skin" object. I´ll expand a bit more.

The problem could be repeated in the next way.

- In wad merger, create a new wad, and put in the the "Lara Skin" object from the original Catacomb.wad, save it (newmesh.wad?)

- Open the the generated newmesh.wad in "TextureAdd", and import any.rec generated from Blender with the plugin (never mind is 256 or 128). Save the wad.

At this moment, if you try to open newmesh.wad again in Wad merger, it pops an error unabling to load the Lara Skin object. (so it get it but with missing meshes and with no textures).


The way that I found to solve it, was not use Lara Skin object for the wad that will go to "TextureAdd". (Instead, I´m using the first animating object also from Catacomb) and it works all the process correctly (after TextureAdd, strpix and such, I can keep opening in wad merger).

My theory, is that the problem was because Lara Skin, is an object compound of multiples meshes (and maybe multiples textures pages), so maybe, when TextureAdd removes the "textures recs" importing the one from Blender, that may leave some meshes with their textures pointers in... ¿who knows where? what may lead to the later problem in Wad merger. But using an animating, because it's only 1 single mesh with some few textures, it looks like that it works without problem.

Maybe that's why some people worked (statics, switches, etc...) and others had problems (outfits, enemies).

But that's just a theory... XD




P.D. I also tested that of triangulate the faces after create the UV map and apply the baking, the rec works and the model can be imported in strpix with the textures on its place, BUT, with many of them rotated wrongly, so in such case, the only what you need is rotate the textures till the looks well, if the mesh if simple, it could help to reduce the triangle textures. But if the mesh is complex, well keep in mind that you would have to rotate the textures by your own, so depends of you if you want triangulate the mesh before or after the UV lightmap pack generation. (before, more triangle textures, after, less triangle texture, but you required to rotate them in strpix).
__________________
Living and Left :)

Last edited by adngel; 08-03-20 at 00:06.
adngel is offline   Reply With Quote
Old 18-04-20, 19:13   #259
LCEF (CA)
Archaeologist
 
LCEF (CA)'s Avatar
 
Join Date: Feb 2010
Location: France
Posts: 1,074
Default

Hi everyone, it's been a while...


I tried it again after a while and it's perfect to give a bit of shadows on moveable objects ! And no need to become mad with texture cropping Thanks for that ! (and even without this technique, with OBJ imp/exp from strPIX I can use Blender forever and ever ! exept if I want double sided faces.. but a little trip in metaseq and it's all done )


I just want to give you some tips about the blender scale. Teme9 suggests settings to have a 2x2 square in blender = 1 square of the editor (like in metaseq) but these settings don't give you round number on the grid anymore (It can be a problem if you want to be precise)

I have an easier set up !
Don't touch anything, keep the original set up of Blender and when you export your mesh (mqo or obj, dxf...) just put 512 in the scale value >> 2 * 512 = 1024 = 1 editor unit.
So you have the right scale for the editor and you keep a round number grid

If you want to import an exported mesh from STRpix, just import your mesh and in the scale of the object do a cross product to have the right scale: 2*1/1024 , and Blender will give you the perfect scale.
2/1024 because you want to have 1024 in 2 blender square (2 for each direction).
To export it again I recomand you to apply the scale and the rotation (ctrl+a > scale and rotation) and put 512 in the scale value of the exporter, like before.


I hope you doing well ! Have a nice day
LCEF (CA) is offline   Reply With Quote
Old 30-04-20, 00:45   #260
RocketLombax
Hobbyist
 
RocketLombax's Avatar
 
Join Date: Mar 2012
Location: United States
Posts: 88
Default

Hi there all! I've got to ask, is there any way to import a proper .mqo file to Blender the same way? I remember at one point, I was able to import a hand, import a gun, and export to Strpix as a single object with only minor face rotation issues on triangles.

I'm not sure what changed, but I can't seem to do it the same way now. And these tools do a fantastic job! But at the same time, there's no way to import .mqo files so that things like weapon combining or model adjustments can be done without needing to totally retexture everything.

Does anybody know any solutions?
RocketLombax is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 16:21.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.