Giter Club home page Giter Club logo

tressfx's People

Contributors

ashleysmithgpu avatar bblock-amd avatar dongsoo-amd avatar jstewart-amd avatar khillesl-amd avatar mrgreywater avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tressfx's Issues

Sample test asset

Hello,
Would it be possible to get the source for the asset used in the sample?
I am having trouble with integrating the skinning system and not having the option to either import my assets to the sample or using the sample asset in unreal makes it impossible to find the source of the issue.

Linux Support?

Does TressFX support linux, if so there are no instructions.

Thanks

Error on Start

Anyone have a clue? I'm not a programmer but keep getting this error on run time

TressFX/amd_tressfx/build/../lib/VS2015/Win32/Lib_Debug/GPUOpen_TressFX.x86d.lib is not a valid Win32 application.

Tried reinstalling VS but didnt help.

Where is TressFX 5.0?

The GPUOpen Website talks about a TressFX 5.0 release and there is a GDC Video talking about it, but there isn't a release or mention of it anywhere in this Repo, what gives?

causing error while exporting .tfxskin and .tfxbone form maya

Maya vision 2016
while exporting .tfxskin:
#NameError : balabala..\TressFX_Exporter.py line 1036: gobal name 'Point' is not define
while exporting .tfxbone
#indexError : balabala..\TressFX_Exporter.py line 728: list index out of range
how should i do to avoid those error?
my model file:
6662.zip

typo in computing shadow accumulation

Hi guys,

Going over the code we assume that intention was to compute: #fibers = distance / (strand radius + spacing between strands) but due to a typo used multiplication instead of addition.

Was that indeed a typo or intentional?

float numFibers = fDepthDistanceWS / (fFiberSpacing * fFiberRadius); // fiberSpacing + fiberRadius is total distance from 1 fiber to another

OpenGL (Vulkan ?) port

I've ported TressFX 2 a year ago to OpenGL here :
https://github.com/vlj/YAGF/tree/master/examples/TressFX
It's using a simple framework I wrote while learning DX12.

The TressFX 2 SDK was included with an AMD helper library for D3D11 which loaded Ruby's head mesh, and enabled an UI controlling some parameters. Is there a port of this library on top of OpenGL or Vulkan ? It would ease integrating my GL port to the official SDK if maintainers agree.

Tressfx 4.0?

Shown in Crimson Relive presentation as avaiable now if rememberl correctly..

Design clarification: shader flow

It is very unclear what is the shader flow of TFX 4.0.

It seems that the main shader procedure in the lib source is missing and what I found in the effects dir of the sample is very unclear.

Could you please clarify how to write a standalone shader for each pass?

asset requirements

There are some requirements for the assets such as:

It would be nice if these requirements could be resolved automatically by resampling the hairs to generate new vertices if necessary, and adding (invisible or duplicate) guide hairs, instead of asserting or crashing.

How to export XGen hair in maya?

I'm a beginner about maya. I have installed the python script of the maya exporter. But when I export the hair which is generated by XGen, it give the warning as following.

Warning: No nurbs curves were selected!

But I can't see any curves in outliner, I only has a description.
image
Does anyone give some suggestions about this problem?

Porting to consoles ?

Hello, firstly thanks to make opensource software :)
I am a console developer, are there any plan to port gpuopen effects on consoles ?
This would be awesome for consoles and also for AMD because with this gpuopen should become far more interesting than gameworks

Sorry for my bad english.

Blender Exporter (suggestion)

Hi if there is any chance for Blender Exporter, cause right now there is only Maya exporter, i think it would be nice addition to open-source technology :)

BUG REPORT: When there are multiple hair objects, ConstBuffer(ConstBuffer_SDF) always uses the data of the last hair object

Hi there,

In the v4.1.0 sample, there are two hair objects, the NumHairVerticesPerStrand is 32 for one and 8 for the other. In other physical pass, the NumHairVerticesPerStrand of these two hair objects is correct.

AMD::sint4 m_Counts;
// int m_NumOfStrandsPerThreadGroup;
// int m_NumFollowHairsPerGuideHair;
// int m_NumVerticesPerStrand; // should be 2^n (n is integer and greater than 2) and less than
// or equal to TRESSFX_SIM_THREAD_GROUP_SIZE. i.e. 8, 16, 32 or 64

Figure.1

Figure.2

But the last physical pass CollideWithHair, both are 8. For all hair objects, it use the data value of the last hair object!
As we can clearly see from the following figure, both hair objects use the same ConstBuffer (Buffer 895):

Figure.3

Figure.4

The process of delivering the ConstBuffer is described in the TressFXSDFCollision::CollideWithHair:

TressFXSDFCollisionParams m_ConstBuffer;

void TressFXSDFCollision::CollideWithHair(EI_CommandContext& commandContext,
TressFXSDFCollisionSystem& system,
TressFXHairObject& hairObject)
{
if (!m_pInputCollisionMesh)
return;
EI_Marker marker(commandContext, "CollideWithHair");
int numTotalHairVertices = hairObject.GetNumTotalHairVertices();
// Get vertex buffers from the hair object.
TressFXDynamicState& state = hairObject.GetDynamicState();
// Set the constant buffer parameters
m_ConstBuffer.m_Origin.x = m_Origin.x;
m_ConstBuffer.m_Origin.y = m_Origin.y;
m_ConstBuffer.m_Origin.z = m_Origin.z;
m_ConstBuffer.m_Origin.w = 0;
m_ConstBuffer.m_CellSize = m_CellSize;
m_ConstBuffer.m_NumCellsX = m_NumCellsX;
m_ConstBuffer.m_NumCellsY = m_NumCellsY;
m_ConstBuffer.m_NumCellsZ = m_NumCellsZ;
m_ConstBuffer.m_CollisionMargin = m_CollisionMargin * m_CellSize;
m_ConstBuffer.m_NumTotalHairVertices = hairObject.GetNumTotalHairVertices();
m_ConstBuffer.m_NumHairVerticesPerStrand = hairObject.GetNumVerticesPerStrand();
commandContext.UpdateBuffer(m_pConstantBufferResource.get(), &m_ConstBuffer);

For each model that collides with the hair object, there is a TressFXSDFCollision instance, but only one TressFXSDFCollisionParams structure instance and one ConstantBufferResource in this TressFXSDFCollision instance.

So, when there are multiple hair objects, there is only one ConstBuffer in the TressFXSDFCollision!

Therefore, the same ConstBuffer is updated after each hair object calls the CollideWithHair function. Regardless of which hair object, the same data from the last hair object is used.


Language: CN

[缺陷报告] 头发的碰撞矫正处理中,当有多个头发对象时,ConstBuffer(ConstBuffer_SDF)始终使用了最后一个头发对象的数据

在v4.1.0版本的示例程序中,有两个头发对象,其中一个头发对象的NumHairVerticesPerStrand为32,另一个为8。在其他的物理计算的pass中,这两个头发对象的NumHairVerticesPerStrand是对的。

AMD::sint4 m_Counts;
// int m_NumOfStrandsPerThreadGroup;
// int m_NumFollowHairsPerGuideHair;
// int m_NumVerticesPerStrand; // should be 2^n (n is integer and greater than 2) and less than
// or equal to TRESSFX_SIM_THREAD_GROUP_SIZE. i.e. 8, 16, 32 or 64

图1

图2

而在最后一个处理碰撞矫正的物理pass中,两个都变成了8。该pass针对所有的头发对象,仅使用了最后一次更新的数据值!

图3

图4

该ConstBuffer的下发逻辑在TressFXSDFCollision中:

TressFXSDFCollisionParams m_ConstBuffer;

void TressFXSDFCollision::CollideWithHair(EI_CommandContext& commandContext,
TressFXSDFCollisionSystem& system,
TressFXHairObject& hairObject)
{
if (!m_pInputCollisionMesh)
return;
EI_Marker marker(commandContext, "CollideWithHair");
int numTotalHairVertices = hairObject.GetNumTotalHairVertices();
// Get vertex buffers from the hair object.
TressFXDynamicState& state = hairObject.GetDynamicState();
// Set the constant buffer parameters
m_ConstBuffer.m_Origin.x = m_Origin.x;
m_ConstBuffer.m_Origin.y = m_Origin.y;
m_ConstBuffer.m_Origin.z = m_Origin.z;
m_ConstBuffer.m_Origin.w = 0;
m_ConstBuffer.m_CellSize = m_CellSize;
m_ConstBuffer.m_NumCellsX = m_NumCellsX;
m_ConstBuffer.m_NumCellsY = m_NumCellsY;
m_ConstBuffer.m_NumCellsZ = m_NumCellsZ;
m_ConstBuffer.m_CollisionMargin = m_CollisionMargin * m_CellSize;
m_ConstBuffer.m_NumTotalHairVertices = hairObject.GetNumTotalHairVertices();
m_ConstBuffer.m_NumHairVerticesPerStrand = hairObject.GetNumVerticesPerStrand();
commandContext.UpdateBuffer(m_pConstantBufferResource.get(), &m_ConstBuffer);

对于每一个会和头发对象产生碰撞的物体模型,都有一个TressFXSDFCollision实例,但该实例中仅存了一个TressFXSDFCollisionParams结构体实例和一个对应的ConstantBufferResource。

当有多个头发对象时,由于该ConstBuffer只有一个,因此每个头发对象都调用CollideWithHair函数后,都是更新的同一块ConstBuffer,因此不管哪个头发对象,都使用了最后一个头发对象的数据!

support inverted depth

TressFX currently uses D3D11_COMPARISON_LESS_EQUAL for z-order comparison. [Reference]

The z-ordering should be optionally D3D11_COMPARISON_GREATER_EQUAL; either via preprocessor definition or TressFX_Desc option. This also requires changes to make sure the ordering of transparent hair strands works correctly.

rationale:
Many engines used in popular games (including GTA V, Witcher 3, Just Cause 2) use inverted (and sometimes logarithmic) depth buffers to increase depth precision.
See

Where is the Sushi source code?

The TressFX repo contains a bunch of prebuilt libraries, headers for them and a LICENSE.txt in amd_tressfx_sample/prebuilt, but there is no link or information about where to obtain the source code.
A web search didn't turn up anything either.

Considering that the license file says the code is under the MIT license, I'd expect the source code to be available somewhere, but no link is provided.

Would it be possible to include the Sushi source code, or add links to where to obtain it?

typos

TressFX\amd_tressfx\src\TressFXSimulation.cpp
L256, there should be 'which' not 'wich'

BUG REPORT and SOLUTION: Wind calculation

Hi there,

In the v4.1.0, there is a serious bug in the wind calculation. In fact, the wind does not work currently. The bug and its fix method are as follows.

1: In the sample, where the wind magnitude is not set at all, m_windMagnitude is only be set to 0.0f during initialization, however m_clampPositionDelta is not used at all, but it can be configured in the ImGUI.

// wind
float m_windMagnitude;
float m_windDirection[3];
float m_windAngleRadians;
float m_clampPositionDelta;

m_windMagnitude(0),

ImGui::SliderFloat("Clamp Position Delta", &simulationSettings->m_clampPositionDelta, 0.0f, 20.0f);

So we can modify the above code to these.

image

2: When calculating the displacement caused by wind, the effect is a vector with magnitude. The shader directly calculates the cross product of the unnormalized v and w, where v is the hair strand vector (with magnitude and direction), and w is wind vector (with magnitude and direction).

float a = ((float)(globalStrandIndex % 20))/20.0f;
float3 w = a*g_Wind.xyz + (1.0f-a)*g_Wind1.xyz + a*g_Wind2.xyz + (1.0f-a)*g_Wind3.xyz;
uint sharedIndex = localVertexIndex * numOfStrandsPerThreadGroup + localStrandIndex;
float3 v = sharedPos[sharedIndex].xyz - sharedPos[sharedIndex+numOfStrandsPerThreadGroup].xyz;
float3 force = -cross(cross(v, w), v);
sharedPos[sharedIndex].xyz += force*g_TimeStep*g_TimeStep;

The vector cross product result is the displacement direction, but the value of each component in the vector has no practical significance. So we need to split into two parts to calculate separately in here, as shown below.

image

After modifying the code as shown above, the wind calculation will be correct and affect the hair strands.

3: The wind calculation and length constraints use the same pass, the length constraints will be iteratively calculated(dispatch multiple times), but the wind calculation does not need iterate, so we need to separate this pass to the wind calculation pass and the length constraints pass.

Implementing TressFX in DX11

TressFX provides sample implementations of TressFX 4.1 in DX12 and Vulkan. I am aiming to implement either 4.0 or 4.1 in an existing DX11 engine, however the TressFX 4.0 implementation, while technically DX11, is opaque due to the fact that it is implemented to interface with a closed-source engine for some reason (Sushi). While the documentation for 4.1 does not explicitly mention DX11, it also does not indicate that support for DX11 has been completely dropped. Would implementing TressFX 4.1 in DX11 be doable by porting DX12EngineInterfaceImpl.cpp to DX11, or is there a hard incompatibility between DX11 and TressFX 4.1?

Additionally, are there any existing code snippets or open-source projects that might help with getting started implementing TressFX 4.0 with raw DX11, rather than one that relies heavily on the closed-source Sushi DLLs?

Thanks!

Disable color picker in UI when color is being read from the model texture

There are two ways to color the hair/fur strands in the viewer:

  1. Hair/fur is a single color from the color picker
  2. Hair/fur gets its color from a texture

When color comes from a texture, the color picker should be disabled in the viewer UI, because it does not affect the color in this situation, and having it accessible when it won't change anything is confusing.

AMD_Types.h should use C99 stdint types

AMD_Types.h contains a series of typedefs that map the C integer types to fixed-size ones, without taking into account different compilers, architectures and OSes. The C or C++ standards mandate no specific size for these types.

Instead, the C99 standard types from stdint.h should be used. These are also available via the std:: namespace by including cstdint in C++ code.

This header has been available in VC++ since at least VS2012.

Possible typos

  1. /amd_tressfx_viewer/src/TFXFileIO.cpp
272             else if ( token.find(L"Ex1") != std::string::npos ) 
273             { 
274                 Ex2 =  (float)_wtof(sTokens[1].c_str()); 
275             } 

Line 272 : should be Ex2 instead of Ex1 ?

  1. /amd_tressfx_viewer/src/main.cpp
402    g_RenderHUD.m_GUI.AddSlider( IDC_OPACITY, iX, iY += AMD::HUD::iElementDelta, AMD::HUD::iElementWidth, AMD::HUD::iElementHeight, 
403         0, 100, (int)(100 * (g_hairAlpha.min - g_hairAlpha.min) / (g_hairAlpha.max - g_hairAlpha.min)) ); 
404 

Line 403: should be (int)(100 * (g_hairAlpha.max - g_hairAlpha.min) / (g_hairAlpha.max - g_hairAlpha.min) ?

Lighting on bear is too "flashy"

Though this has been improved since the initial release on GitHub, the lighting on the bear still seems a little wonky. Not sure if it is in the specular or the shadows (or both), but the lighting flashes as the bear animates. The issue goes away if you disable simulation in the UI.

We are looking into it.

Better quality demo assets

The assets have low quality and have several problems, It would be nice to have better assets for this demo.

The animation of the default asset, the bear, is rather jerky. Additionally, the texture is low resolution, doesn't fit to the hair and also looks like there are some major UV-Mapping issues on his right side: Image.

The shading of the hair also looked better (more highlights, better specular, less diffuse) in TressFx 2.2
Comparison:
Version 2.2:
TressFX 2.2
Version 3.0.1
TressFX 3.0.1
edit: This is most likely caused by the fact that by default only SUPERSIMPLESHADING is activated. Not sure why this is the default.

When increasing the wind magnitude, it is appearent that the hair-ends of ponytail are fixed, and the color of her scalp is different then the hair itself.

All in all I think it's functional, but there is room for improvement.

Ratboy source fbx?

I'm working on a custom engine integration, recreating the demo scene. It would be great if you could provide the source for ratboy, like you did in tressfx v3 sample models. I need an asset that i know will work rather than making my own during initial integration.

Please and thanks!

API documentation

It would be nice to have documentation for the API and maybe some samples. Right now all the functions take a TressFX_Desc which contains public state about the Hair asset, but it is unknown which fields need to be set before each function call, and which fields are modified.

Additionally, there seem to be unused members in the TressFX_Desc, such as mWorld, which make it quite frustrating to work with TressFX. The name mWorld suggests it's supposed to be the world transform for the model, but in fact it does nothing, it's not used anywhere in the code, and modelTransformForHead has to be used instead.

[reflection] integrate Bullet to gpuopen ?

I think that AMD need a conccurent to physx.
Bullet is an opensource physics engine, it Just need plugin of game engine to be more widely used.
The release 3.0 should be awesome in performance jump because it will fully use openCL.
So I think it should be awesome for gamers and for AMD to promote bullet in pushing it under the gpuopen umbrella, and optionnaly in accelerating the 3.0 development and plugins

https://github.com/bulletphysics/bullet3

Vulkan 1.2.x shader compiler problem

Vulkan demo works fine with shader compiler (glslc.exe version 1.1.x) from binary release, but when I use compiler from vulkan version 1.2.x it fails to compile shaders.

Add a .clang-format file?

Clang format is a tool shipped with clang that can reformat file to match a given code style. It's often difficult to strictly follow a code style in a project especially if you work on others projects with different code style ; clang format just check and fixed that automatically. It can even be run as a git script so that no commit "break" style.

I tried to write a config file that defines the code style in tressFx. However it looks like tressFx is using an extra space inside parenthesis in function body (in if/for/...) , but not in function declaration. Unfortunately clang format has a single spaceInParenthesis that is used for every occurrence of parenthesis, whether it's in code or in declaration.
Is it important to have space inside parenthesis? Using clang format would avoid contributor and reviewer to spend time on checking indent, space, alignment of parenthesis, * location and so on.

No doc folder

No doc folder in directory amd/tressfx/ like said in the description. The documentation is supposed to be here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.