New HL Model Viewer Progress


Trp. Jed
08-07-2003, 06:17 PM
Right,

Despite Marzy trying to get me to add more features to it, I've manged to get the Half-Life model viewer working with the new new model texture options.

Marzy has been helping me test and bar a few tiny bugs its pretty much done as far as adding basic missing features. We have some ideas for other stuff to add into it but thats down to time and my lacking skills in C++.

So without further ado, heres some more screenshots.

- Jed

Trp. Jed
08-07-2003, 06:18 PM
Number 1:

Transparent texture support.

You can choose two methods of showing transparency. The default is the best but doesnt smooth the edges like DoD does. The second does but is buggy with the drawing order.

Unless your anal, the first method is fine.

- Jed

Trp. Jed
08-07-2003, 06:19 PM
Number 2:

Additive Texture support.

Not really much to say here. if your using additive textures HLMV will show them now.

- Jed

Trp. Jed
08-07-2003, 06:20 PM
Number 3:

Enhanced Texture options.

Now you can set texture render modes from within HLMV. Yup, now you can change textures or options without having to recompile your models. Handy for those just doing re-skins.

- Jed

08-07-2003, 06:35 PM
HOLY **** M8!!

NICE FEATURES!

Foley
08-07-2003, 07:17 PM
What he said ^ :eek: :eek:

I don't want to seem ungrateful, but do you think you will be able to make it so that it shows v_models with their ingame origins?:cool:

Trp. Jed
08-07-2003, 07:25 PM
I'll see...

The main aim was to add support for transparent and additive textures because thas what I needed.

Marzy has a few ideas too. I cant promise anything, I'll just see what I come up with.

- Jed

Faceman
08-07-2003, 07:32 PM
Nice to see you released it.

That origin thing would be great, not sure if possible though.

Jed love to hear back on that PM whenever you get a chance, thanks man.

Trp. Jed
08-07-2003, 07:34 PM
Originally posted by Faceman
Nice to see you released it.

That origin thing would be great, not sure if possible though.

Jed love to hear back on that PM whenever you get a chance, thanks man.

Havent released it yet, still working on some stuff.

And yeah I'll get back to you - I've been a bit swamped for a couple of days. I havent forgotten.

- Jed

Klown
08-07-2003, 08:05 PM
i love you.


in a plutonic heterosexual way of course.:o

Russ. Conscript
08-07-2003, 08:51 PM
wow. that transparency this is jus wat i need. im so sick of going in and out of games , just to see if it works on my cusom model or not.

Joe Anderson
08-07-2003, 09:02 PM
all I can say is DAMN!!!!!!!!!! Cant wait man. Your becoming a God on these forums:)

Anderson

MaRzY
08-07-2003, 09:14 PM
Originally posted by Russ. Conscript
wow. that transparency this is jus wat i need. im so sick of going in and out of games , just to see if it works on my cusom model or not.

It's even better then that Russ, instead of adding these sort of commands

$texrendermode "hedgehog_test.bmp" "masked"
$texrendermode "hedgehog_test2.bmp" "additive"

to your qc file.

All you need to do now is tick the relevant flag/flags transparent, additive or chrome under the texture tab in HLMV for those textures you would like any of these features to work with, and save your model.

So gone are the days of decompiling a model just to add a command to the qc file for a transparent or additive texture, then having to recompile it again.

All this aswell as being able to view transparent textures under two different settings and also additive textures within HLMV.

How cool is that.....:).......he's had me swinging around on me chandeliers........:)

Strider
08-07-2003, 10:46 PM
This is a great day in modeling and skinning, but what about a legal issue, are u allowed to redistribute HLMV with these modifications...

Trp. Jed
08-08-2003, 04:07 AM
Apparently its not a problem to distribute it but as Mugsy said in the other thread:

http://www.dayofdefeat.net/forums/showthread.php?s=&threadid=14475&perpage=15&pagenumber=2

his version which already supports these features (which I didn't know about) and Faceman is going to distribute it.

Bit of a pain in the ass seeing as I just spent 3 bloody days hacking the source to make it work :(

- Jed

ripa
08-08-2003, 08:10 AM
Some great stuff there Trp. Jed! If possible, could you briefly explain what you had to alter/add/remove in the sources to make that work? I've taken three programming courses (two c++) and made extensions for a game called Clonk but I just can't get the hang of programming other things than Hello World type things :/

- NazguL -
08-08-2003, 08:48 AM
VGJ, indeed! I cant wait to try it!

Dillinger
08-08-2003, 12:58 PM
The resizing of textures without having to decompile is brillance!

Sgt.Sinister
08-08-2003, 01:53 PM
Another feature you could add could be the option of editing the .qc from within HLMV so that you could..say...add custom sounds to each weapon so that their reloads all sound unique, or add crouch animations without having to decompile and recompile. The great thing about this feature would be that we wouldn't have to decompile and recompile just to end up with misaligned textures. *gasp* Or the feature to realign textures. And something else you could do would be able to make HLMV play sounds so you could check your custom weapon sounds without having to go in-game.

Again, good job, I really love what you've done.

Sgt.Sinister
08-08-2003, 08:40 PM
Just wanted to bump cause I got some good ideas..:D

Russ. Conscript
08-08-2003, 11:09 PM
Originally posted by MaRzY
It's even better then that Russ, instead of adding these sort of commands

$texrendermode "hedgehog_test.bmp" "masked"
$texrendermode "hedgehog_test2.bmp" "additive"

to your qc file.

All you need to do now is tick the relevant flag/flags transparent, additive or chrome under the texture tab in HLMV for those textures you would like any of these features to work with, and save your model.

So gone are the days of decompiling a model just to add a command to the qc file for a transparent or additive texture, then having to recompile it again.

All this aswell as being able to view transparent textures under two different settings and also additive textures within HLMV.

How cool is that.....:).......he's had me swinging around on me chandeliers........:)

oh..my god..

/dies

cant wait to use it, you guys are doing some excellent work here!

Trp. Jed
08-09-2003, 09:06 AM
Originally posted by ripa
if possible, could you briefly explain what you had to alter/add/remove in the sources to make that work?

In the studio_utils.cpp file (which I believe came with the HL SDK) is a function called UploadTextures. When I looked at it I noticed that it only uses RGB textures and not RGBA which includes an alpha channel for tranparency.

Textures in the MDL format are stored much like 8-bit BMPs. There is a palette with each colour having a unique ID number and then the RGB values for that ID. The image is then just a list of ID numbers telling it what palette colour to use for that pixel.

I re-wrote part of the function to go through each pixel in the image and look up its RGB value in the palette and copy it to a buffer.

To make the transparency I check the header flags for the specific texture and see if the transparency flag is set. If so when I look at each pixel, i check to see if its ID is 0xFF (255) which is the last colour in the palette. If it is I write 0x00 (0) into the alpha channel for that pixel, else I write 0xFF (255) instead. For textures which aren't flagged as transparent all alpha channel bytes are written as 0xFF.

What we've now got is an 8-bit texture converted to a 32-bit RGBA texture with an alpha channel telling us which parts are transparent or not.

In the rendering part of the viewer as I cycle through the meshes to draw them I check for the transparency flag in the texture and, if set, turn on AlphaTesting for that mesh. This means that when its drawn the alpha map is used and the bitmap appears transparent.

The preferred way of using the alpha map is to use the OpenGL Blending functions which give nice soft edges to the transparency. However you have to draw all your messages back-to-front (furthest away first) but the HLMV doesnt sort meshes like that and hence it doesnt work properly. I just opted to use alpha testing which gives a sharper edge to the transparency but without the need for sorting.

The other trick I did was to replace whatever colour was last in the palette (usually blue or red) for transparent textures with black during the buffering of the texture.

The reason for this is that HLMV scales down textures and you end up with a blurred edge. If your transparent pixels are blue, you get a slight blue hint to the edge of the transparency. Changing them to black makes it less noticiable.

I'm still looking to see if I can improve the scaling function - 512x512 textures get scaled to 256x256 which is why they always look blurry in HLMV.

As for the additive textures, when the HLMV draws the meshes I check to see if the additive flag is set and if so draw the mesh with a blending function of GL_ONE, GL_ONE which is a basic additive texture.

The other bits and pieces in the code are just setting/unsetting of flags and basic housekeeping tasks.

- Jed

Trp. Jed
08-09-2003, 09:14 AM
Originally posted by Dillinger
The resizing of textures without having to decompile is brillance!

I don't know where you read that but you cant resize a texture in it, just set the transparency, chrome or additive options without a decompile.

If you want to resize a texture you'll still have to decompile it and alter the UV map yourself.

Originally posted by Sgt.Sinister
Another feature you could add could be the option of editing the .qc from within HLMV so that you could..say...add custom sounds to each weapon so that their reloads all sound unique, or add crouch animations without having to decompile and recompile. The great thing about this feature would be that we wouldn't have to decompile and recompile just to end up with misaligned textures. *gasp* Or the feature to realign textures. And something else you could do would be able to make HLMV play sounds so you could check your custom weapon sounds without having to go in-game.

The ability to assign event sounds to animations is in Mugsy's version and I want to add it to this version to.

As for the other ideas, yeah would be nice wouldnt it but i'm not a C++ programmer.

80% of the code for HLMV I don't understand. It just happens I use other C++ type languages so I understand the relevant bits. Most of my work on this has been me looking up various bits and pieces on good, transcribing code on paper and running test values through it to see what comes out the other end.

I dont intend to add a load of bloat to the HLMV just stuff which reduce the monotonous tasks.

- Jed

ripa
08-09-2003, 11:02 PM
Omfg Jed you rock! First I had problems compiling the thing (I downloaded the wrong source). Then I had problems running it (the debug build doesnt work because of some missing dlls; gg win98). But now I managed to build a working version. And I even added a feature to it: it supports textures up to 1024x1024! Omfg! Yeah, Half-Life does in fact support textures up to 1024 in either dimension. Not 1024x1024, but 1024x256! Just check out my AVS m/36 model. (Jed just up the MAX_TEXTURE_DIMS in studio_utils.cpp from 512 to 1024 to do the trick :D)

I'll probably have a working transparency-support version of my own soon :o

I wonder if it's this one that sets the alpha:
out[3] = 0xFF;

Thanks again Jed!

MaRzY
08-11-2003, 08:00 PM
Here is a list of features from Jed's latest build i'm testing.

Textures:-
The option to turn transparent, additive or chrome on and off on individual textures in real time, so no need anymore to save your model and load it again to see the changes.

Save options:-
You can now save your options, so no need to change the background colour etc, every time you reboot the program.

Sequence info:-
New text box in the Sequence panel shows basic information for
the current sequence.

dump model info:-
Dumps info on bones, textures, groups and much much more to notepad.

Ground Colour:-
Bug in the original HLMV where the ground wouldnt change colour
is fixed.

comment:-
Weather Jed adds anymore features or not to this program, as it stands now it's already a winner in my eyes, top stuff Jed...:)

Nixon
08-11-2003, 08:28 PM
Originally posted by Trp. Jed


Unless your anal, the first method is fine.

- Jed

lol :D

rotzbua
08-12-2003, 09:04 AM
great trp...

ya thinking of a release in next time? :D

08-12-2003, 09:08 AM
You could add an option to put a perspective camera at whatever bone you want, could require some coding though, there is a similar option in Deep Exploration (which is open source, you could get the code from there)

Ska Wars
08-12-2003, 09:30 AM
Bloody nice work jed, especially like the sound of resizing the skins and adding the transparancies (which i always have problems with)

Can't wait till it's release, great job.

Ska

Day of Defeat Forum Archive created by Neil Jedrzejewski.

This in an partial archive of the old Day of Defeat forums orignally hosted by Valve Software LLC.
Material has been archived for the purpose of creating a knowledge base from messages posted between 2003 and 2008.