Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OIT-MSAA #13

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ source/*/VisualStudio*/*/*/*.res
source/*/VisualStudio*/*/*/*.tmp
source/*/VisualStudio*/*/*/*.cache
source/*/VisualStudio*/*/*/*.ib_tag
source/*/VisualStudio*/*/*/*.recipe
source/*/VisualStudio*/*/*/*pdb_index
*.FileListAbsolute.txt
# Android Studio:
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# FaceGen Base Library

Copyright (c) 2019 Singular Inversions Inc.
Copyright (c) 2020 Singular Inversions Inc.

A simple cross-platform C++11 library for developing computational 3D graphics applications.

Expand All @@ -21,8 +21,7 @@ A simple cross-platform C++11 library for developing computational 3D graphics a
* Functional and declarative design in as much as makes sense for C++.
* Extensive use of return value elision.
* Declarative GUI layout, declarative dataflow graph for computations.
* Minimal OOP-fuscation; Some member functions and constructors, few private members, no inheritance.
* Prefer std::function and std::bind to abstract class interface.
* Minimal OOP-fuscation; Some member functions and constructors, few private members, no impl inheritance.
* Templates are used when they provide clear benefit; Avoid complex template metaprogramming.
* Exceptions and RAII used throughout.
* Compiles out of the box; No dependencies, install scripts or special make packages required.
Expand Down
17 changes: 9 additions & 8 deletions compile.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<html>
<head>
<meta charset="UTF-8">

<style>
a {
text-decoration: none;
Expand All @@ -27,7 +28,8 @@
<title>FaceGen Base Library Manual </title>
</head>
<body>
<nav><p><a style="color:#FFFFFF" href="index.html">Install</a><p><a style="color:#FFFFFF" href="quick.html">Quick Start</a><p>Compile
<nav>
<p><a style="color:#FFFFFF" href="index.html">Install</a><p><a style="color:#FFFFFF" href="quick.html">Quick Start</a><p>Compile
</nav>
<section class="body">
<h1 style="font-size:200%"><span style="color:#CCCCCC"><span style="color:#4471AF">F</span>ace<span style="color:#4471AF">G</span>en</span> Base Library Manual </h1>
Expand Down Expand Up @@ -73,8 +75,8 @@ <h2>iOS</h2>
<code>~sdk/source/</code> directory, add each of the following (expand glob):
<code> LibFg* LibFgBase/src LibTpBoost/boost_1_67_0 </code>
</ul>
<p>Make a copy of the directory <code>~sdk/data/</code> containing only the data you need
(see <a href="deploy.html">Deployment</a>), and add that data into your app bundle
<p>Make a copy of the directory <code>~sdk/data/</code> containing only the data you need
and add that data into your app bundle
preserving the directory structure (one way to do this is to right-click on your application directory
in Xcode, select 'Add Files', select 'Create folder references', ensure 'Copy items if needed' is
de-selected, than select your copy of the <code>~sdk/data/</code> directory). </li>
Expand Down Expand Up @@ -129,18 +131,17 @@ <h2>Android</h2>
&nbsp &nbsp &nbsp &nbsp LibTpBoost ) <br>
</samp> <br>
<li> Create an assets folder for FaceGen data: <code> File -> New -> Folder -> Assets Folder </code>
and copy in the data you need (see <a href="deploy.html">Deployment</a>) preserving the directory
and copy in the data you need preserving the directory
structure.
</ul>
<p> Android is poorly designed as asset files cannot be accessed via standard filesystem
<p> In Android, asset files cannot be accessed via standard filesystem
calls. The simplest approach is to make a local filesystem copy of all bundled data you need with
FaceGen when your app first runs. You can then pass this location to <code> fgSetDataDir() </code>.

FaceGen when your app first runs. You can then pass this location to <code> setDataDir() </code>.

</section>
<footer style="text-align:center; background-color:#4471AF; color:#FFFFFF; width:100%">
<div style="height:1px"></div>
<p>&copy; Singular Inversions 2019
<p>&copy; Singular Inversions 2020
<div style="height:1px"></div>
</footer>
</body>
Expand Down
Binary file modified data/base/Mouth.tri
Binary file not shown.
Binary file added data/base/MouthSmall.tri
Binary file not shown.
29 changes: 0 additions & 29 deletions data/base/shaders/Common.hlsl

This file was deleted.

143 changes: 0 additions & 143 deletions data/base/shaders/Transparent.hlsl

This file was deleted.

64 changes: 0 additions & 64 deletions data/base/shaders/directx11_main.hlsl

This file was deleted.

13 changes: 13 additions & 0 deletions data/base/shaders/dx11_opaque.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

#include "dx11_shared.hlsl"

float4
PSOpaque(Frag frag)
: SV_Target // A "system-value semantic" specifying output be stored in a render target
{
float3 albedo = albedoMap.Sample(sstate,frag.uv).rgb;
float3 mod = modulationMap.Sample(sstate,frag.uv).rgb;
float3 ma = albedo * mod * (255.05f/64.0f);
float3 color = calcColor(frag,ma);
return float4(color,Scene.ambientColor.a);
}
Binary file added data/base/shaders/dx11_opaque_PS.cso
Binary file not shown.
61 changes: 61 additions & 0 deletions data/base/shaders/dx11_resolve.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#include "dx11_shared.hlsl"

RWTexture2D<unorm float4> BackBuffer : register(u0);
Texture2D<uint> HeadPointersSRV : register(t0);
StructuredBuffer<ListNode> LinkedListSRV : register(t1);

static const uint FRAGMENT_COUNT = 48;
static const uint MSAA_SAMPLE_COUNT = 4;

struct ListSubNode {
float depth;
uint color;
};


[numthreads(8, 8, 1)]
void CSResolve(uint3 id : SV_DispatchThreadID) {

float4 backBuffer = BackBuffer[id.xy];
float4 resolveBuffer = float4(0.0, 0.0, 0.0, 0.0f);

uint headOfList = HeadPointersSRV[id.xy];
if (headOfList == 0xFFFFFFFF)
return;

ListSubNode nodes[FRAGMENT_COUNT];
for (uint sampleIdx = 0; sampleIdx < MSAA_SAMPLE_COUNT; sampleIdx++) {

uint count = 0;
uint nodeIdx = headOfList;

while (nodeIdx != 0xFFFFFFFF && count < FRAGMENT_COUNT) {
ListNode node = LinkedListSRV[nodeIdx];
if (node.coverage & (1 << sampleIdx)) {
nodes[count].depth = asfloat(node.depth);
nodes[count].color = node.color;
count++;
}
nodeIdx = node.next;
}

for (uint i = 1; i < count; i++) {
ListSubNode t = nodes[i];
uint j = i;
while (j > 0 && (nodes[j - 1].depth < t.depth)) {
nodes[j] = nodes[j - 1];
j--;
}
nodes[j] = t;
}

float4 dstPixelColor = backBuffer;
for (uint index = 0; index < count; index++) {
float4 srcPixelColor = unpackColor(nodes[index].color);
dstPixelColor = lerp(dstPixelColor, srcPixelColor, srcPixelColor.a);
}
resolveBuffer += dstPixelColor;
}

BackBuffer[id.xy] = resolveBuffer / MSAA_SAMPLE_COUNT;
}
Binary file added data/base/shaders/dx11_resolve_CS.cso
Binary file not shown.
Loading