• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

3D Model Viewer

Hmm, interesting question. I guess the best I can do is to make a fullscreen viewer. On the other website you would need the ability to create an <iframe> tag or similar. What options do you have?

EDIT: Also, the model viewer is on Github so you can do what you want anyway.

I don't have much knowledge in that :V I probably using it on Wix/Wordpress/just put it on some of the hive thread if it is possible
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Does someone know where the cliff textures of TFT are placed?
RoC cliff textures are at ReplaceableTextures/Cliff/, however I cannot find the cliff textures for Icecrown Glacier / Dalaran Ruins / Black Citadel / Outland / Sunken Ruins.

Also, does someone know how water works?
I know they have 45 images per tileset water, but just looping between these images makes for a very blocky animation, rather than the more or less smooth animation in the game.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
I know they have 45 images per tileset water, but just looping between these images makes for a very blocky animation, rather than the more or less smooth animation in the game.
What if they were looped at 60 fps or does it make it animate too fast? Otherwise they would need to be performing an inter frame blend to interpolate a an a water animation image.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
Does someone know the logic of ribbon emitters?
Not sure this is helpful, but they do depend on frame rate. At lower frame rates they place ribbon points less often, possibly because the points are placed every game frame or something like that. They still last the correct amount of time but at low frame rates the lack of points means they can be quite ugly as opposed to their normally smooth nature.

Unfortunatly you probably need to run a quick test. Change a ribbon texture to have unique strips of colour perpendicular to the expansion direction and cause the ribbon to expand a long distance (eg teleport triggers). If they remain the same ratio then it is expanding by wrapping the texture around. If the strips are stretch then it expands by stretching.
 
Level 50
Joined
Dec 29, 2014
Messages
1,950
I have to ask something about the Hive's viewer. It really lags when I open it want to check some model. It's so slow and lagging. I have old computer so I think that's the reason. My graphic card is 128 mb and RAM memory 1 gb.
I was wonderring if there is a way to 'minimize' the lag somehow?
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
I still have some optimizations to do, but they mostly relate to having many models loaded. If you mean it lags for you with one model, there isn't really anything to do about it, since it's your hardware.

Out of interest, do you mean start up is slow, or the actual rendering?
 
Level 50
Joined
Dec 29, 2014
Messages
1,950
I still have some optimizations to do, but they mostly relate to having many models loaded. If you mean it lags for you with one model, there isn't really anything to do about it, since it's your hardware.

Out of interest, do you mean start up is slow, or the actual rendering?
It lags with every model I open.
It's the rendering. I guess there isn't other fix for me but to change my computer.
 
Level 49
Joined
Apr 18, 2008
Messages
8,421
I've encountered issues with the BETA viewer.

The test model used for these two errors is:
Night Elf Ranger (Main model for the first error, Portrait model for the second error.)

Some textures do not load:

0125e3c175.png


(These have teamcolor.)

Sometimes, models will not load:

e3a769cb6d.png

In fact - this seems to happen often (always?) with Portrait models. Perhaps something to do with the Cameras? Or the distance from center?

The camera controls are off. Right-click no longer moves the camera (pans it), mouse wheel is either too slow or too fast, the camera starts way too zoomed out. The camera controls and settings in the original viewer are much better.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
@Deolrin The texture used is not power of two and is thus invalid. I will add an error for this for future debugging (although I don't think Ralle is actually logging errors).

I cannot say anything about the error, because it doesn't happen to me, and it doesn't look like it's related to the viewer.
If you want to test it further, rather than left-clicking on View in 3D, middle click it to open in a new tab.
If the error originates in the viewer, it will be visible, rather than being obfuscated by the surrounding code.

As to the camera - that needs to be relayed to @Ralle, I no longer make the main client.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
@Deolrin The texture used is not power of two and is thus invalid. I will add an error for this for future debugging (although I don't think Ralle is actually logging errors).
WC3 supports textures that are not power of 2...

One or both of its dimensions are not a power of two. That's a requirement of BLP.
No it is not. You can happily make a blp texture like 111*111 and WC3 will load it, mipmaps and all. Recently it will even load textures such as 1920*1080 however it still will only load the lowest mipmap level that is less than or equal to 512 in both dimensions.

So it would seem. Maybe one of the recent patches added NPOT support.
WC3 has always supported not power of 2 textures. When I first started my research into the blp format I discovered this, and that was before the latest wave of updates.

I have no idea who came up with the idea that WC3 textures must be powers of 2. It is only recommended they are powers of 2 to make mipmap generation easier. If the textures are not a power of 2 then the reduction per level can be over half (by 1 pixel), and hence cause problems with aliasing because the common anti-alias filters only work up to a half reduction. To get around this one has to use filters such as area sampling which are considerably more computationally intensive and often not available in common image APIs.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
Added support for NPOT BLPs by scaling up to the nearest power of two when required.
Is there a technical reason why you cannot use a texture that is not a power of 2 directly? Is it some kind of OpenGL ES limitation? As far as I am aware GPUs do not have any issue using non power of 2 textures, just they are avoided for other reasons.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
They are avoided because GPUs certainly have issues with them - one cannot use mipmapping or a repeating wrap mode with NPOT textures.
These are not needed for things like data textures (e.g. hardware skinning), but they are for diffuse textures.
A situation where you don't need it for diffuse textures is in 2D games, where you usually don't need mipmapping and repeating.

Added automatic up-scaling also to TGA and BMP textures.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
I do not know the exact details of NPOT on different driver implementations, however they are problematic regardless.
It has nothing to do with supporting NPOT, and everything to do with usage limitations and performance.

Again, I do not make the main client anymore. The fact that I fix things doesn't mean you'll immediately see changes on the hive.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Latest version is 4.0.9.
The version should be printed to the browser's console. If you have any issue, please specify the version.
Note that it might not always be synchronized on all clients (Hive's model viewer, the map viewer, the sanity test, ...)

This version mostly added optimizations to the MDX handler, making rendering maps at decent frame rates much more feasible.
For example, when rendering Lost Temple (the heaviest map I tested so far), performance went from 35 FPS to 52 FPS on my computer.

Culling is currently off, so performance doesn't change if models go out of the camera's view.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Latest version is 4.0.10.

Simple point culling is active again.
This mostly makes maps function much faster, by not updating and rendering things that are not seen by the camera.
This does mean the viewer will be slightly slower when you zoom all the way out and everything is visible.
It will be optimized in the future.

The map handler got updated.
Thanks to @Azsure for helping me figure new stuff out.
It is probably not a well known fact, but there is a map client at Map | HIVE
 
Last edited:
Level 29
Joined
Jul 29, 2007
Messages
5,174
Latest version is 4.0.21.

Added support to reading and writing most of the internal map files, technically allowing any kind of editing, but so far without any easy to use API, just raw data.
Just as an example of how it can be used, I created a function that applies a heigtmap image to a map's terrain, which someone asked for.

Fixed many issues with MDX rendering, some of which were introduced in version 4 due to the whole overhaul of the rendering code.
Most models should look a lot more correct now, especially more complex ones.

Attached two comparison images from the unit tests, although they don't quite capture the changes.
 

Attachments

  • teams_after.png
    teams_after.png
    78.6 KB · Views: 174
  • teams_before.png
    teams_before.png
    73.6 KB · Views: 167
  • water_elemental_after.png
    water_elemental_after.png
    56.3 KB · Views: 169
  • water_elemental_before.png
    water_elemental_before.png
    52.2 KB · Views: 163

pyf

pyf

Level 32
Joined
Mar 21, 2016
Messages
2,985
@Dr Super Good & @GhostWolf : about your 'Power of 2' discussion:

Warcraft 3 was officially designed to run on a 8 MB 3D video card (TNT, i810, Voodoo 3, Rage 128 equivalent or better) with DirectX8.1 support. I suspect that at least one of these video cards does not support power of two textures.


Quoting a small part of this post from Gamedev.net:

" [...] My problem is that I face severe graphics card limitations. I have a voodoo 3 2000, it supports a maximum texture size of 256x256 (OUCH!!), 3 multitexture layers, no pixel shaders, no vertex shaders, only power of two textures, 16 megs video RAM limit. [...]"


Voodoo3 - Architecture and performance - Wikipedia
(please also see their API compliance)
 
Last edited:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
Warcraft 3 was officially designed to run on a 8 MB 3D video card (TNT, i810, Voodoo 3, Rage 128 equivalent or better) with DirectX8.1 support. I suspect that at least one of these video cards does not support power of two textures.
Except WC3 does not enforce the limit... Both TGA and BLP files can be loaded as non power of 2 textures. Further more TGA files are not even subject to a maximum texture size limit like BLP files are (one can easily load a 1920*1080 sized TGA as a texture in WC3). Although it might have been the case that such textures were highly bug prone in the past, that is certainly not the case anymore as all modern supported GPUs support larger than 512*512 textures and non power of 2 textures.
 

pyf

pyf

Level 32
Joined
Mar 21, 2016
Messages
2,985
Is there a technical reason why you cannot use a texture that is not a power of 2 directly? Is it some kind of OpenGL ES limitation? As far as I am aware GPUs do not have any issue using non power of 2 textures, just they are avoided for other reasons.
I have no idea who came up with the idea that WC3 textures must be powers of 2. It is only recommended they are powers of 2 to make mipmap generation easier. If the textures are not a power of 2 then the reduction per level can be over half (by 1 pixel), and hence cause problems with aliasing because the common anti-alias filters only work up to a half reduction. To get around this one has to use filters such as area sampling which are considerably more computationally intensive and often not available in common image APIs.
I assume that is an OpenGL ES thing, since OpenGL does support NPOT textures since early 2000s.
Just answering your questions here. Power of two textures allow Warcraft 3 to run and look as intended, on the video hardware it was officially designed for in 2002.

[...] Although it might have been the case that such textures were highly bug prone in the past, that is certainly not the case anymore as all modern supported GPUs support larger than 512*512 textures and non power of 2 textures.
3D accelerator video cards from the mid-1990s up until the early 2000s were designed that way iirc. That is as simple as that. Therefore, all the textures found in video games had then to be power of two textures, in order to comply with the technical limitations of the 3D hardware of their day.

Except WC3 does not enforce the limit... Both TGA and BLP files can be loaded as non power of 2 textures. Further more TGA files are not even subject to a maximum texture size limit like BLP files are (one can easily load a 1920*1080 sized TGA as a texture in WC3). [...]
Fine, but I am guessing that the results would be... sub-optimal on some of the video hardware the game was originally designed to run on. I am guessing there would be visual glitches / artifacts, or the textures may not load, or they may look blurry, or the game engine might eventually simply crash when trying to load such textures.
 
Last edited:
Level 29
Joined
Jul 29, 2007
Messages
5,174
Does anyone know what exactly a line-emitter particle emitter is?
It is used in the Thunderclap Caster model to make a circle of particles.
Without it being set, the particles are spawned randomly.
Are the rules for this known? (e.g. does it simply disable randomness, or is there more to it)


Doesn't matter.
 

pyf

pyf

Level 32
Joined
Mar 21, 2016
Messages
2,985
[...] all modern supported GPUs support larger than 512*512 textures [...]
For the record, even 3D accelerator video cards from the mid-late 1990s could have support for texture size larger than 256*256.

iirc, a lousy SiS 6326 AGP video card supported 512*512 textures, while an even more lousy S3 ViRGE DX PCI video card supported 1024*1024 textures iirc. The problem was that such video cards had other severe technical limitations (and sometimes also buggy drivers). Therefore, they were not really suitable for decent hardware accelerated 3D gaming.

The only ones from that era which were recommended (and suited) for 3D gaming were the 3Dfx Voodoo series of video cards (Voodoo and Voodoo 2). And both of them had a texture size limit of 256*256, by design. Same for Voodoo 3 video cards.

... and of course, none of the video cards mentioned above had Non power of 2 texture support afaik.
 
Last edited:
Level 29
Joined
Jul 29, 2007
Messages
5,174
Latest version is 4.0.25.
  • Texture wrap modes are now used.
  • The line-emitter flag of particle emitters is now supported. Previously all particle emitters were line emitters.
  • Fixed the width/length handling of particle emitters.
  • Tail particles are working again, and are a lot more correct than they were in the past.
  • The repeat value of particle emitters is now used.
Many models should look more correct.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
The ModelViewer class offers a toBlob(callback) method.
You can save the given blob as an image with standard JavaScript.
E.g. something along the lines of:
JavaScript:
viewer.toBlob((blob) => {
    let url = URL.createObjectURL(blob);
});
You can get all sorts of different scripts that allow to download urls easily. For the unit tester, I use this simple function:
JavaScript:
function downloadUrl(url, name) {
    let a = document.createElement('a');

    a.href = url;
    a.download = `${name}.png`;
 
    a.dispatchEvent(new MouseEvent('click'));
}
You get full control over the viewer with the update(), render(), and updateAndRender() methods.
This means you can indeed move frame by frame and take screenshots if you desire.
It is a bit troublesome that toBlob() is asynchronous, so you cannot run this kind of code in a simple loop. I thought about changing it to promises at some point, which will allow you to effectively have this code:
JavaScript:
async function record(viewer, frames) {
    for (let i = 0; i < frames; i++) {
        viewer.updateAndRender();

        // Note the async/await!
        let url = URL.createObjectURL(await viewer.toBlob());

        downloadUrl(url, `frame_${i}`);
      }
}
I have done this in the past to make the auto-generated gif's of models when I made that demo gallery client that no one liked.
There isn't any code currently for this, however I won't mind making a quick implementation if you want. The actual recording really just takes the above tiny function if I change to promises from callbacks. The actual work here is the UI to let you select animations and what or what not to record, a way to move the camera, and so on. If I'll do it, I am not going to spend a lot of time at all on any kind of proper UI.

I am not sure what you mean by the second part.
If you mean just rotating the model or having the camera rotate around the model, you can do both with standard node operations.
 
Last edited:
Top