View Single Post
Old 02-16-13, 01:07 PM   #14
gap
Navy Seal
 
Join Date: Jan 2011
Location: CJ8937
Posts: 8,215
Downloads: 793
Uploads: 10
Default Problem editing vegetation.GR2 meshes

I am currently trying to change tree sizes by scaling their meshes, rather than by reducing the size of their texture's visible part, as done by Echolot for his Smaller Trees Mod.
As long as texture sizes remain unchanged, this method would ensure better tree resolution with no increase of memory usage (Smaller Tree's transparent pixels are anyway loaded in memory).

Silent hunter trees are simple "billboard" meshes, composed by 8 vertices and 4 faces in 1 subset; basically 2 rectangles intersecting each other at 90 deg, roughly along their respective axes of symmetry:



SH5 trees are untypical objects. As far as I can understand, they have no material nor texture assigned in their GR2 files. Their textures, as well as vegetation.GR2's to be used for each ecoregion and each season, are found in a set of ini files in dat/Terrain/Textures_and_Vegetation.

On opening any of the vegetation.GR2 files, the program prompts us as follows:



On TDW's suggestion, during my past attempts I confirmed that I wanted the missing 'essential' strings to be added, and shortly after I received this message:



After saving, closing and reopening the same file, I selected a mesh and exported its Vertex data (no other Export checkbox selected).
Here's the content ot the generated obj file for Tree2 of 1.Small Vegetation and Temperate Alpina/vegetation.GR2:

Code:
# Exported by GR2Editor/Viewer v1.1.285.1
# Exported from GR2 file C:\Users\Gabriele\Desktop\Dynamic Environment SH5-V2.2\MODS\DynEnv v2.2 - 12.a Smaller Trees - 75%\data\Terrain\Textures_and_Vegetation\1.Small Vegetation and Temperate Alpina\vegetation.GR2
#
mtllib Tree2.mtl
o Tree2
# 1 subsets, 8 vertices, 4 faces
v -29,466270000 2,492133000 1,440153000
v -31,541330000 2,492133000 -1,151663000
v -31,541330000 0,053065750 -1,151663000
v -29,466270000 0,053065750 1,440153000
v -31,854800000 2,492132000 1,176825000
v -29,280560000 2,492132000 -0,884170500
v -29,280560000 0,053065750 -0,884170500
v -31,854800000 0,053065750 1,176825000
#
#
g Tree2_subset0
usemtl Tree2_subset0
# 12 vertices, 4 faces
f 8 7 5
f 7 6 5
f 4 3 1
f 3 2 1
...and this is the mtl file:

Code:
newmtl Tree2_subset0
Ns 0,000000000
Ka 0,588235300 0,588235300 0,588235300
Kd 0,588235300 0,588235300 0,588235300
Ks 0,900000000 0,900000000 0,900000000
Ke 0,000000000 0,000000000 0,000000000
map_Ka Tree2.Tga
map_Kd Tree2.Tga
map_Ks Tree2.Tga
In order to make sure that everything was okay, I imported back the exported mesh (again, only 'Vertex Data' checked), and I got confirmation that...



...and that...



Encouraged by these first results, I discarded the changes and I imported the obj file generated by GR2 editor into Wings 3D 1.4.1, where I made the following changes:
  • split one of the basal edges in two segments, thus generating a median vertex.
  • scaled down the object using the new vertex as pivotting point
  • removed the new vertex

I exported then the modified meshes. The new obj file looked like this:

Code:
# Exported from Wings 3D 1.4.1
mtllib Tree2scaled.mtl
o Tree2
#8 vertices, 4 faces
v -29.72565250 1.88236619 1.11617600
v -31.28194750 1.88236619 -0.82768600
v -31.28194750 5.3065750e-2 -0.82768600
v -29.72565250 5.3065750e-2 1.11617600
v -31.51705000 1.88236544 0.91868000
v -29.58637000 1.88236544 -0.62706663
v -29.58637000 5.3065750e-2 -0.62706663
v -31.51705000 5.3065750e-2 0.91868000
vn 0.78063262 0.0000000e+0 -0.62499017
vn 0.78063262 0.0000000e+0 -0.62499017
vn 0.78063262 0.0000000e+0 -0.62499017
vn 0.78063262 0.0000000e+0 -0.62499017
vn 0.62499150 0.0000000e+0 0.78063155
vn 0.62499150 0.0000000e+0 0.78063155
vn 0.62499150 0.0000000e+0 0.78063155
vn 0.62499150 0.0000000e+0 0.78063155
g Tree2_Tree2_subset0
usemtl Tree2_subset0
s 1
f 1//1 3//3 2//2
f 1//1 4//4 3//3
f 5//5 7//7 6//6
f 5//5 8//8 7//7
mtl file:

Code:
# Exported from Wings 3D 1.4.1
newmtl Tree2_subset0
Ns 100.0
d 1.0
illum 2
Kd 0.5882353 0.5882353 0.5882353
Ka 0.5882353 0.5882353 0.5882353
Ks 0.9 0.9 0.9
Ke 0.0 0.0 0.0
They don't resemple the original files

When I try to import vertex data of the modified object into the vegetation GR2 file, GR2 Editor becomes unresponsive.
I have also tried pasting the modified vertices coordinates into the obj file generated by GR2 Editor:

Code:
mtllib Tree2.mtl
o Tree2
# 1 subsets, 8 vertices, 4 faces
v -29.72565250 1.88236619 1.11617600
v -31.28194750 1.88236619 -0.82768600
v -31.28194750 5.3065750e-2 -0.82768600
v -29.72565250 5.3065750e-2 1.11617600
v -31.51705000 1.88236544 0.91868000
v -29.58637000 1.88236544 -0.62706663
v -29.58637000 5.3065750e-2 -0.62706663
v -31.51705000 5.3065750e-2 0.91868000
#
#
g Tree2_subset0
usemtl Tree2_subset0
# 12 vertices, 4 faces
f 8 7 5
f 7 6 5
f 4 3 1
f 3 2 1
This hybrid file is read correctly by Wings 3D, but again, when I try importing it into GR2 Editor, nothing happens

Any idea guys?
gap is offline   Reply With Quote