Categories
shader tools tutorials

Lut Bake for Substance Painter.

AUTHOR: JPLEE

leegoonz@163.com

Substance Painter Color Profile A to Z part 1. - 知乎

I think you will understand a little bit about Tome mapping and Post Process Stack code structure by watching the previous two lectures. 看了前面两节课,我想你会对时间映射和后处理堆栈代码结构有一点了解。

Overview.

After 2019, there were several requirements that I was received when communicating with the art team, and They wanted theirs rendering result after using post-processing in the game engine and the rendering result when working in the Substance painter to maintain the same tone as possible.

If you search the Internet, you can easily obtain UE4 ACES Tonemapping LUT, so there was no problem with basic settings.

However, there is a big problem with this, which is that only support Unreal-Engine only.

You can also get the Standard ACES Tonemapping LUT, but the problem with this is that Unity developers don’t really like using Unity’s internal ACES.

Also, it is likely related to the fact that it is not simply using tone mapping limited to HDR to LDR.

I came up with some ideas to solve these various situations, but I think the current method can be the easiest way to solve this.

2019年之后,我在和美术组沟通的时候收到了几个要求,他们希望他们在游戏引擎中使用后处理后的渲染结果和在Substance Painter中工作时的渲染结果尽可能保持相同的色调 .

网上搜一下,很容易就能得到UE4 ACES Tonemapping LUT,所以基本设置没有问题。

但是,这有一个很大的问题,那就是只支持虚幻引擎。

您还可以获得标准 ACES 色调映射 LUT,但问题在于 Unity 开发人员并不真正喜欢使用 Unity 的内部 ACES。

此外,这可能与这样一个事实有关,即它不仅仅是使用仅限于 HDR 到 LDR 的色调映射。

我想出了一些想法来解决这些各种情况,但我认为当前的方法可能是解决这个问题的最简单方法。

Wanna know more about this?
Jump to my link as notion page used below.

https://jplee.notion.site/Lut-Bake-for-Substance-Painter-389c5a02fd184023a2c0361dbc9b7ef0

Categories
shader tools

Post Process Tone Mapping Editor Tweak.

Purpose:
This course will be given to the art department flexibility.
We will try to add parameters to Neutral Tone-mapping and use editor mode.
Depending on the nature of the project, try adding Fast Tone mapping, which focuses on faster operation, to the Post Process.
Let’s try porting Unreal Engine’s Aces tone mapping to Unity.
Exploring this course will give us a better understanding of Unity’s post-processing rendering architecture.

Adding parameters to Neutral Tone mapping.

The desired results are as below.

Eventually, as shown in the figure below, it is to change what is fixed as a constant inside the function to a parameter and to allow the artist to modify the value in this way to reach the desired result.

The above parameters are not exposed in the original Neutral Tonemapping.

Since the segment could not be modified, additional color adjustments or color curves are often added.

Unlike Unreal Engine, ACES does not expose any parameters.

Let’s add various tone mapping and expose related parameters to meet the learning purpose.

Neutral Tone mapping function.

This tone mapping method has minimal impact on color hue and saturation.
– But in my opinion that this is some impact on gamma.

Filmic Tonemapping Operators – Filmic Worlds

Neutral function is based on Uncharted 2 operator of JOHN HABLE.

Take a look Uncharted 2 operator function curve.

Desmos | 그래핑 계산기 Uncharted 2 operator function curve

Location.

At first, let’s find the tone mapping code function that needs to be modified.

Packages/com.unity.postprocessing@3.1.1/PostProcessing/Shaders/Colors.hlsl

float3 NeutralCurve(float3 x, float a, float b, float c, float d, float e, float f)
{
    return ((x * (a * x + c * b) + d * e) / (x * (a * x + b) + d * f)) - e / f;
}

float3 NeutralTonemap(float3 x)
{
    // Tonemap
    float a = 0.2;
    float b = 0.29;
    float c = 0.24;
    float d = 0.272;
    float e = 0.02;
    float f = 0.3;
    float whiteLevel = 5.3;
    float whiteClip = 1.0;
    
    float3 whiteScale = (1.0).xxx / NeutralCurve(whiteLevel, a, b, c, d, e, f);
    x = NeutralCurve(x * whiteScale, a, b, c, d, e, f);
    x *= whiteScale;

    // Post-curve white point adjustment
    x /= whiteClip.xxx;

    return x;
}

Neutral Tone mapping Original function code.

We will add parameters to the above code.

float3 NeutralTonemap(float3 x) Add parameters to the head of this function.

float3 NeutralTonemap(float3 x, float A, float B, float C, float D, float E,
      float F, float WL, float WC)

Want to know more?

Try to becomming my patreon members.

Post Process Tone Mapping Editor Tweak. | JP Lee on Patreon

Categories
tools

Custom Curve Tone map generated Substance LUT.

Fully Support to Neutral tone mapper and ACES and finally Custom Curve tone map also available generation Hollywood style LUT for Substance Painter.

Reference

Filmic Tonemapping with Piecewise Power Curves – Filmic Worlds

Categories
tools

MaterialX with Substance Painter batch installer.

https://github.com/leegoonz/MaterialX_batchInstall

MaterialX Shader generation

Categories
tools

Texel density complexity viewer.

Texel density complexity viewer.

Categories
tools

Mip-chain artist template by Substance designer.

커스텀 밉맵체인에 대응하는 Substance designer template 제작을 간단하게 소개 하고 게임엔진에서 사용하는 툴의 특성을 이해 한 후 TA 가 어떤 추가 업무를 추진 할 수 있는지 소개한다.

신규 Graph 를 생성 하고 Graph Name 을 설정하세요.

일단 간단하게 템플릿을 제작 한 후 이것을 다시 PIXEL PROCESSOR 로 제구성 할 것이다.

Categories
tools

Custom Mipmap encoding practice.

此示例不是生产级别。该示例可以在生产级别使用,但是可以通过添加更有效的功能将其升级到完整的生产级别功能。
This example is not a production level.
This example can be used at the production level, but it can be upgraded to a full production level function by adding more efficient features.

实验目的。
公司内部还没有请求,但是我们根据JP Friends Company项目团队提出的类似要求进行研究。
通过改善Unity mipmap过滤的质量并改善模糊的Texel采样,我们希望改善更清晰的法线贴图表达(中等距离)或Albedo表达。
在粗糙的情况下,不需要改进。

Purpose of experiment.
There is no request from within our company yet, but we study this based on the similar demand that arose from the project team of JP Friends Company.
By improving the quality of Unity mipmap filtering and improving the ambiguous Texel sampling, we want to improve a more clear normal map expression (medium distance) or Albedo expression.
In the case of roughness, there is no need to improve.

Preview of concept demonstration.

在上面的代码中,有用于预处理步骤和后处理步骤的功能。

如果您看一下代码,它会将 @”.mip(\d)+$”  作为子字符串处理。

预处理文件由filename.mipNum.format组成。

换句话说,需要以下结构的文件来计算用户mipmap。

originalTex.png

originalTex.mip1.png

originalTex.mip2.png

originalTex.mip3.png

originalTex.mip12.png

必须满足上述格式。

In the code above, there are functions for the pre-processing step and the post-processing step.

If you look at the code, it is processing @”.mip(\d)+$” as a substring.

The preprocessed file consists of filename.mipNum.format.

In other words, a file with the following structure is required to calculate the user mipmap.

originalTex.png

originalTex.mip1.png

originalTex.mip2.png

originalTex.mip3.png

.

.

originalTex.mip12.png

The format above must be satisfied.

有必要将其提高到生产水平。
让我们与DEVOPS团队合作。

It is necessary to raise it to the production level.

Let’s work with the DEV-OPS team.

将通过修改Mip级别获得的结果与默认设置结果进行比较

Compare the result obtained by modifying the Mip level with the default setting result

On the left, a custom mip-chain was applied, and on the right, the mip-chain result directly created by Unity.
All aniso level = 0 and Kaiser filter is applied.
左侧应用了自定义Mip链,右侧应用了Unity直接创建的Mip链结果。
所有aniso级别= 0,并应用Kaiser滤波器。

我们了解了上述方法。

学习了此后,TA可以得到什么想法?

我们如何在渲染纹理像素的过程中应用以上概念?

如果您无法创建想法,那么程序员和TA之间有什么区别?

让我们想想。

此外,可以使用DCC程序进一步开发它。

在此过程中,您可以理解TA是超越程序员思想极限的人。

We learned the above approach.

What ideas can TA get after learning this?

How can We apply the above concept in the process of rendering texels?

If you can’t create an idea, what’s the difference between a programmer and a TA?

Let’s think.

In addition, it can be further developed by using the DCC program.

In this process, you can understand that TAs are people who go beyond the limits of programmers’ ideas.

Further learning.
Mip chain is easily produced using SD.
Create a mip chain generator using SD and create a template.

Addition reading reference documents.

https://code.google.com/archive/p/nvidia-texture-tools/wikis/ApiDocumentation.wiki

https://developer.nvidia.com/gpugems/gpugems2/part-iii-high-quality-rendering/chapter-28-mipmap-level-measurement

https://developer.nvidia.com/nvidia-texture-tools-exporter

Categories
tools

Tree leaf color painter from 2016 in years.

In general, leaves use a vertex color channel for wind effect.
We can define vertex color for color expression in uv2 or Tangent for richer color effect.
Also we can add this to our extended c-buffer to do GPU instancing.
In 2016, GPU instances were not added, so we optimized them using a different method.

通常,叶子使用顶点颜色通道获得风的效果。
我们可以定义顶点颜色以在uv2或Tangent中表达颜色,以获得更丰富的颜色效果。
我们也可以将其添加到扩展的c缓冲区中以进行GPU实例化。
在2016年,未添加GPU实例,因此我们使用另一种方法对其进行了优化。

Categories
tools

TERRAIN DECAL EDITOR 制作功能需求 第一版

这主要通过两个步骤完成。
首先,创建一个基于网格的基本贴花。

Overview: Collect the opinions of artists participating in the X2M project and propose alternative opinions. Because the number of mixed textures of the terrain is limited, we provide a function for precise expression of very special areas or small areas.
The advantage allows specific areas to be expressed in detail.
Disadvantages occur a slight overdraft.
Recommendation: It is recommended not to use it in large areas, but only use it in special situations that cannot be expressed due to the limited number of texture samplers in the terrain.


概述:收集参与X2M项目的艺术家的意见并提出替代意见,因为地形的混合纹理数量有限,因此我们提供了一种用于非常特殊区域或较小区域的精确表达的功能。
优点允许详细表达特定区域。
缺点发生轻微透支。
推荐:建议不要在大区域中使用它,而仅在由于地形中纹理采样器数量有限而无法表达的特殊情况下才使用它。

Basic concept.

If We need a more special texture in a specific area when blending the terrain texture as shown in the picture above, add a Texture Sampler in the terrain shader to prevent increasing the amount of terrain shader computation.
Biome Blending, which has not yet been developed, can be partially replaced. (Generally, overseas developers have a system that separately manages zones and zone junctions in the terrain editing tool for biome blending.)
The above process is the process of additional texture work for a specific area using the pre computed deferred decal mesh and edge blending shader.

如上图所示,如果在混合地形纹理时需要在特定区域中使用更特殊的纹理,请在地形着色器中添加一个纹理采样器,以防止增加地形着色器的计算量。
尚未开发的生物群落混合技术可以部分替代。 (通常,海外开发人员拥有一个系统,该系统可以在地形编辑工具中单独管理区域和区域交界处以进行生物群系融合。)
上面的过程是使用预先计算的递延贴花网格和边缘混合着色器对特定区域进行额外纹理处理的过程。


Test of Abstractive concept

Categories
tools

OthorCulledGPU_LightMapper_Manager

If you guys live in China use to below link button please.

Overview.

根据针对场景lightmap效果改善的调查结果,发现现在美术在制作的时候效率非常低

首先来理解一下照明美术的特性吧。

因为没有完全使用实时GI,所以需要进行烘焙

这个时候需要进行非常多的修改制作

照明美术的作业需要非常细致,并且结果直接关系到最终的用户体验,因此可以支持反复预览查看的制作环境是一个非常重要的核心要素

现在古剑的业务工作流中很多要素是自动化的

以前也提过很多次,好的品质是需要将自动化减少到最小的

带着匠人精神自己一个细节一个要素的开关各个选项,去观察每个照明的值以及物件的GI相关设定值带来的变化,美术同学根据自己的理解完成最终效果

制作这个工具的根本原因是现在的工作环境,无法在短时间内让美术同学及时确认到场景的照明设置结果,从而保证品质

除去几个程序组提及的问题之外,如果这个工具可以帮助美术同学在每个区域都能达到高品质的话,那我们就来把这个功能做出来吧

Inspection list.

使用金街场景进行了实验

金街场景整体在全部Visible的基本环境内针对特定区域画面进行了实验,Progressive GPU light-mapper平均需要2分30秒~3分钟左右。

通常为了准确确认感觉,在计算阶段需要将时间缩短至15秒~30秒。

现在Local场景的Contribution GI是全部关掉的状态。

意思就是照明美术无法在本地确认应用GI效果的结果。

Contribution GI关掉的原因据程序组所说,是因为某个需求设置为关闭状态,只在烘焙服务器运行时自动打开。 Contribution GI选项如果是开着的状态,会使 CPU占有率增加,影响某个部门的业务。

Contribution GI option risk test.在场景内添加了约4k个物件,测试选项在被激活和被关闭时的状态下,CPU的占有度变化测试时,必须关掉Auto Generate lightmap选项实际上在本地制作的场景Auto Generate lightmap选项需要关闭烘焙命令以快捷键的形式提供给美术的话,个人认为美术可以直接点击按钮任何CPU占有度都基本上没有变化

•烘焙时间测定 •测试GPU : RTX 2080 TI Super. •使用了约3k个Contribution static物件 •所有物件的Stitching seams关闭。(无需所有物件都应用,如果全部打开,会使烘焙服务器处理时间暴增:此部分在CPU内另外处理,处理完之后开始生成烘焙数据。)

Baketime via GPU : estimated time around 2 hours 52 min

•烘焙时间测定 •使用了约3k个Contribution static物件 •放大部分领域测定时间 •需要加快处理时间,但是毫无帮助 •生成了所有数据的cash数据

•烘焙时间测定 •对于Contribution静止物件,使用Scene View Clip. •Scene View Clip是一个概念性的名称 •根据Game View的occlusion culling概念 •是除去现在Scene view内看到的物件之外,将mesh render关闭的概念

Baketime via GPU : estimated time around 1 min17 Second


•对于Scene View Clip… •使用 Isolation plugin的情况,将多个物件放在list的耗时很长 •实现Octree之后,将全部场景提前存储在物件list里试试 •金街在520 * 520 * 520内,放了所有的数据 •将Octree Cell横向竖向以10的高度为进行分割,似乎可以按照52m的3次元空间针对物件list进行快速接近 •以分割cell为标准,按照Scene view camera的cull distance展示物件是最好的 •但是也可以根据研发难度,以相似的概念进行研发

•不使用Octree 的方法 •使用Main Camera •在camera添加一个实现定好规格的Box Collider •Box Collider的大小美术是可以直接修改的,因此容易上手操作 •Box Collider大小我们可以把它看做照明美术想要部分细调的照明测试区域的空间的概念

•不使用Octree 的方法 •Box Collider内部有物体进来的话,执行以下函数 •现在场景的Contribution GI flag是false。(基本值) •做好以下函数之后,有物体进到Box Collider的话,应用光照图相关的Flag,如果物体不进到Box Collider,再重新对 ContributionGI flag进行解体

private static void SetStaticEditorFlag(GameObject obj, StaticEditorFlags flag,  bool shouldEnable)
{
    var currentFlags = GameObjectUtility.GetStaticEditorFlags(obj);

    if (shouldEnable)
    {
        currentFlags |= flag;
    }
    else
    {
        currentFlags &= ~flag;
    }
  
    GameObjectUtility.SetStaticEditorFlags(obj, currentFlags);
}

•Demo脚本构成 •为验证功能的必要性,使用内部函数进行简略实现 •使用了OnTriggerEnter和OnTriggerExit函数 •发现的问题 •以上两个Event函数值在runtime启动 •无法使用ExecuteInEditMode • •只套用功能的概念,我们使用Physics函数再直接试试