VOGONS


ATI TruForm

Topic actions

First post, by Dege

User metadata
Rank l33t
Rank
l33t

I move all TruForm or general N-patch related posts to this topic.

RaVeN-05 wrote on 2021-07-25, 10:33:

P.S. Have big hopes that ATI TruForm coming to wrapper

TBH, I don't know. Once a while ago I evaluated if it could be implemented but it turned out to be very problematic.
ATI TruFrom is 'N-patch', subdividing/curving triangles based on the vertex normal vectors.
There also were RT-patches (rect-triangle patches) supported in DX8/9 and those were based on different concepts than "just enable it and it just works" N-Patches, needing additional vertex data to the geometry.
I say it because the tesselator on modern hw is the generalized form of 'RT-patches' so ATI TruForm is not compatible with it. It subdivides the triangles along a different pattern and also, culling can't be controlled on per-triangle basis.
Geometry shaders (which are slow) could help here and a modern hw may be able to render the old DX8 truform-geometry with a decent performance but from an engineer's point of view, the implementation would be very inefficient.

Last edited by Dege on 2021-08-19, 14:14. Edited 1 time in total.

Reply 1 of 39, by WSH303

User metadata
Rank Newbie
Rank
Newbie
Dege wrote on 2021-07-28, 13:15:
TBH, I don't know. Once a while ago I evaluated if it could be implemented but it turned out to be very problematic. ATI TruFrom […]
Show full quote

TBH, I don't know. Once a while ago I evaluated if it could be implemented but it turned out to be very problematic.
ATI TruFrom is 'N-patch', subdividing/curving triangles based on the vertex normal vectors.
There also were RT-patches (rect-triangle patches) supported in DX8/9 and those were based on different concepts than "just enable it and it just works" N-Patches, needing additional vertex data to the geometry.
I say it because the tesselator on modern hw is the generalized form of 'RT-patches' so ATI TruForm is not compatible with it. It subdivides the triangles along a different pattern and also, culling can't be controlled on per-triangle basis.
Geometry shaders (which are slow) could help here and a modern hw may be able to render the old DX8 truform-geometry with a decent performance but from an engineer's point of view, the implementation would be very inefficient.

In 2007 AMD released some demos with code examples and documentation of NPatches tessellation using geometry shaders:

"N-patches is a technique that smoothens mesh surfaces by tessellating
the triangles and uses the vertex normals to compute a smoothly
interpolated surface. This is useful as a mesh compression technique
or just to improve visual quality of existing low-polygon artwork. Some
hardware supported fixed function n-patch tessellation in the past, but
with geometry shaders we can now easily implement n-patches
without dedicated hardware. Additionally it can now be used together
with techniques like vertex skinning."

Stuff works fine on both AMD and NVIDIA GPUs. Performance is good, 120fps@3440x1440. Would that help?

Attachments

  • Untitled.jpg
    Filename
    Untitled.jpg
    File size
    688.58 KiB
    Views
    2306 views
    File license
    Public domain

Reply 2 of 39, by Dege

User metadata
Rank l33t
Rank
l33t

Thanks, I read the related documents, that's how I evaluated the possible implementation.
Geometry shaders are slow relative to the pure vertex-only processing, I suppose a modern hw could handle the Truform impl at good performance.

But, on the original ATI hw the triangle tesselator stage is before the vertex shaders in the pipeline, while geometry shader is next to the vertex shader stage on a modern GPU.
That's what make things complicated and "not too efficient" when insisting on the exact TruForm effect.

Anyway, I'll see.

Reply 3 of 39, by Dege

User metadata
Rank l33t
Rank
l33t

I made an experimental implementation for TruForm (only works with the FF vertex pipeline, no shaders). Cubic positions, quadratic normals. 😁

Tested only with Morrowind:
https://www.youtube.com/watch?v=x3dPkxzCQk4

According to my brief tests, it needs about 3x more GPU power than plain vertex-only mode (but Morrowind FPS Optimizer is highly configurable, so it's more like an average case).

Reply 4 of 39, by RaVeN-05

User metadata
Rank Member
Rank
Member

oh my god , you awesome , i just cryis so hard by happines =0

i compiling list , searching games, and will test and debunk
ATI TruForm - all games, software that use that technology

also i will stream games by long time with ati truform , starting today
at ~21:00 by Kiev time, (GMT +2 hours) (Helsenki .... time zone)

https://hexenworld.org/forum/index.php (Heretic's & HeXen's forum)
https://www.youtube.com/user/whitemagicraven
https://go.twitch.tv/whitemagicraventv

Reply 5 of 39, by WSH303

User metadata
Rank Newbie
Rank
Newbie
Dege wrote on 2021-08-18, 20:01:
I made an experimental implementation for TruForm (only works with the FF vertex pipeline, no shaders). Cubic positions, quadrat […]
Show full quote

I made an experimental implementation for TruForm (only works with the FF vertex pipeline, no shaders). Cubic positions, quadratic normals. 😁

Tested only with Morrowind:
https://www.youtube.com/watch?v=x3dPkxzCQk4

According to my brief tests, it needs about 3x more GPU power than plain vertex-only mode (but Morrowind FPS Optimizer is highly configurable, so it's more like an average case).

Smoother than Skyrim 😁 Which version of Morrowind do you have? GOG or original?

Reply 6 of 39, by Dege

User metadata
Rank l33t
Rank
l33t

I have the original, but that shouldn't matter I think.

Also, keep in mind that this is only an initial half-baked implementation, it doesn't yet work for apps using vertex shaders (like the ATI Dolphin demo).
TBH, I don't know how I'll able to allocate time to finish it all and also give a bit more optimized version.

Reply 7 of 39, by Shing

User metadata
Rank Newbie
Rank
Newbie

This is crazy to see working and with good performance. I guess modern hardware can compensate with good raw performance. 😁

It's sad that you don't have time to work on this fully. This is something that should be made OFFICIALLY by Windows, GPU developers or whatever. Microsoft should hire you for your wrapper alone as this is something that needs to be done eventually tbh.

Reply 8 of 39, by Dege

User metadata
Rank l33t
Rank
l33t
Shing wrote on 2021-08-21, 20:47:

This is crazy to see working and with good performance. I guess modern hardware can compensate with good raw performance. 😁

It's sad that you don't have time to work on this fully. This is something that should be made OFFICIALLY by Windows, GPU developers or whatever. Microsoft should hire you for your wrapper alone as this is something that needs to be done eventually tbh.

Thanks, it'd be nice, but...

Btw, I poured a lot of work into it to somewhat finish the feature, now shaders also should work. I tested it with the ATI Dolphin demo:

https://www.youtube.com/watch?v=NPVZT9GBI2s

I'm going to test it with some games and after that I could release a WIP for that. I don't know what to try first. UT 2004?

Reply 10 of 39, by RaVeN-05

User metadata
Rank Member
Rank
Member

Dege, oh my ... , you are God in programming, that amazing, i have list of TruForm games, i try to find all and compile complete list, and test it on hardware , i will try to test Serious Sam The First Encounter to tell the TruForm feature is working in Direct3D. Will say, the UT 2003 or 2004 is good idea last time i tried it with TruForm it worked and as i remember corectly these games running on Direct3D

Deffnator wrote on 2021-09-01, 02:40:

it would be interesting to see this at work with Hexen 2, RTCW, Quake 2 and Q3A

Unfortunatelly its all OpenGL API games its not compatible with dgVoodoo, we can hope of support Direct3D games here.
Maybe some wrappers From OpenGL To Direct3D API can help, but i really doubt ...

P.S. Maybe if FTEQW support Direct3D and TruForm at same time, hmm will try that at evening, to tell.

https://hexenworld.org/forum/index.php (Heretic's & HeXen's forum)
https://www.youtube.com/user/whitemagicraven
https://go.twitch.tv/whitemagicraventv

Reply 11 of 39, by Expack3

User metadata
Rank Member
Rank
Member
Dege wrote on 2021-08-31, 20:34:
Thanks, it'd be nice, but... […]
Show full quote
Shing wrote on 2021-08-21, 20:47:

This is crazy to see working and with good performance. I guess modern hardware can compensate with good raw performance. 😁

It's sad that you don't have time to work on this fully. This is something that should be made OFFICIALLY by Windows, GPU developers or whatever. Microsoft should hire you for your wrapper alone as this is something that needs to be done eventually tbh.

Thanks, it'd be nice, but...

Btw, I poured a lot of work into it to somewhat finish the feature, now shaders also should work. I tested it with the ATI Dolphin demo:

https://www.youtube.com/watch?v=NPVZT9GBI2s

I'm going to test it with some games and after that I could release a WIP for that. I don't know what to try first. UT 2004?

UT2K4 seems like a good starting point.

EDIT: Oh, and there's a decent list of documented TruFrom games on Wikipedia: https://en.wikipedia.org/wiki/ATI_TruForm
Certainly wouldn't call it definitive, but I'd call it a good starting point for finding D3D games which support TruForm.

Reply 12 of 39, by Dege

User metadata
Rank l33t
Rank
l33t

I released a new WIP with the TruForm support.
Things tested by me, so far:

- Morrowind: works
- ATI Dolphin demo: works
- UT2004: No matter if I set "UseNPatches = True and TesselationLevel = (something > 1)" in the ini files, the game doesn't set the tesselation level to other than 1. So, it doesn't work, no idea for the time being why.
- Serious Sam: works

As you can see, the implementation is poorly tested. Also, some parts of the impl could be more optimized, I hope I can do that some day.
The tesselation can put a big weight even onto a modern GPU, if too many objects in the scene are tesselated at a high level.

Last edited by Dege on 2021-09-02, 11:03. Edited 1 time in total.

Reply 13 of 39, by Expack3

User metadata
Rank Member
Rank
Member

FINALLY!!!

Thanks so much for this, Dege!

Also, out of curiosity, how hard would it be to add a "force n-patches" feature to dgVoodoo2? My hope for such a feature would be that, since it would be hijacking the render pipeline, would help debug n-patch support in games which do support it but, for some reason, aren't working with dgVoodoo2.

Reply 14 of 39, by Dege

User metadata
Rank l33t
Rank
l33t

It'd be easy to add such an option, but it's not a wise idea in regard of the performance. When the game is aware of n-patches then the engine controls what objects are subject to tesselation, at what level (e.g. depending on the distance), etc (see Morrowind FPS optimizer, how fine granurality of configuration it provides).

If the tesselation is forced then every mesh with untransformed vertices (practically everything except the HUD) become part of the tesselation, even if no normal vectors are available for a given mesh. In that case the inner tesselated positions are interpolated linearly, leaving the triangle as an unbulged flat polygon but with unnecessary requiring much more computing power than normally.

I experimentally did it with UT2004 at a mid-level tesselation, and while it worked, the performance was trash. There were scenes (outer view onto a lot of buildings, terrain objects) where I only got 8(!) FPS (GTX 1060).

Reply 15 of 39, by Deffnator

User metadata
Rank Member
Rank
Member

a N-patch tweaker would be necessary for the games in question, if not made internally to make use of it or externally like what Morrowind FPS Optimizer does.

Also FPS Optimizer doesnt work with MGE XE by the looks of it

Reply 16 of 39, by Expack3

User metadata
Rank Member
Rank
Member
Dege wrote on 2021-09-02, 11:18:

It'd be easy to add such an option, but it's not a wise idea in regard of the performance. When the game is aware of n-patches then the engine controls what objects are subject to tesselation, at what level (e.g. depending on the distance), etc (see Morrowind FPS optimizer, how fine granurality of configuration it provides).

If the tesselation is forced then every mesh with untransformed vertices (practically everything except the HUD) become part of the tesselation, even if no normal vectors are available for a given mesh. In that case the inner tesselated positions are interpolated linearly, leaving the triangle as an unbulged flat polygon but with unnecessary requiring much more computing power than normally.

I experimentally did it with UT2004 at a mid-level tesselation, and while it worked, the performance was trash. There were scenes (outer view onto a lot of buildings, terrain objects) where I only got 8(!) FPS (GTX 1060).

Debug features are rarely meant to be performant. 😁

Reply 17 of 39, by WSH303

User metadata
Rank Newbie
Rank
Newbie
Dege wrote on 2021-09-02, 11:18:

I experimentally did it with UT2004 at a mid-level tesselation, and while it worked, the performance was trash. There were scenes (outer view onto a lot of buildings, terrain objects) where I only got 8(!) FPS (GTX 1060).

But for screen shot purpose it would be nice 😁 Guys using Reshade does that a lot, they set some insane settings on shaders, take a nice looking screenshot and call it a day. Great job anyway 😀 I made a quick test in ATI Rachel demo, it uses tessellation if "mode = npatchh" is set in config file. And it fails unfortunately.
download/file.php?mode=view&id=118296

Oh and something I just noticed, Dolphin demo works fine, bit slow but fine. But GPU (GTX1080) utilization is 0%, yet CPU (6700k) 20%. Does NPatches work in software mode maybe?

Oh 2nd, can we also add TrueForm to virtual card Radeon 9700 with DX9 support?

Attachments

  • Capture.JPG
    Filename
    Capture.JPG
    File size
    214.52 KiB
    Views
    793 views
    File license
    Public domain

Reply 18 of 39, by RaVeN-05

User metadata
Rank Member
Rank
Member

Where i can download that cATI Rachel demo &?

https://hexenworld.org/forum/index.php (Heretic's & HeXen's forum)
https://www.youtube.com/user/whitemagicraven
https://go.twitch.tv/whitemagicraventv