Jump to content

[1.9.x] Textures Unlimited - PBR-Shader, Texture Set, and Model Loading API


Shadowmage

Recommended Posts

If a model has more then one texture what do I do?

For example, the model

    model = MiningExpansion/Parts/Size1Generator/Model

has 3 textures

    texture = fuellcell, Squad/Parts/Resources/FuelCell/fuellcell
    texture = ksp_l_batteryPack_diff, Squad/Parts/Electrical/z-4kBattery/ksp_l_batteryPack_diff
    texture = tank4, Squad/Parts/FuelTank/fuelTankT100/tank4

I can not assign a shader. Need help, please.

Link to comment
Share on other sites

2 hours ago, alexus said:

If a model has more then one texture what do I do?

Models are made of one or more meshes. Whether you choose to apply the shader to all meshes or just specific ones is up to you. 

The original documentation can be found here: https://github.com/shadowmage45/TexturesUnlimited/wiki/Config-Documentation
Note that the documentation is not up-to-date and you need to switch a few words around to match the newer syntax.

 

2 hours ago, alexus said:

I can not assign a shader. Need help, please.

Yes you can; the shader can be assigned via model or via part. You may want to read this thread to see countless examples, questions, and other information provided already in this thread.

 

20 hours ago, alexus said:

Alpha channel does not work for transparent shader. :(

Is it true?

No. The transparent shader works the same way as all the KSP translucent shaders, but adds smoothness/metallic. You can also use it in place of cutout shaders if the alpha values do not require the threshold.

 

@Shadowmage You may want to update the github wiki to reflect the current syntax. You may also consider adding a spoiler FAQ to the OP to include a bunch of the questions from throughout the thread along with your answer in a formatted way.

Link to comment
Share on other sites

5 minutes ago, Gordon Dry said:

Looks good, but a little like if you ironed the surface of the "crumpled foil" with a really hot iron ... you know what I wanna say? Perhaps the "bump map edges" look too sharp or something ... ?!

IMHO

You're right . If I can do it better - I will do it :) In any case, this is better than stock texture.

Edited by alexus
Link to comment
Share on other sites

@alexus

The alpha channel of a texture using the transparent pbr shader is opacity.

The solar shader is complicated; I've not been able to properly figure out how it works, but @Shadowmage has examples in his SSTU mod.

Aside from normals, the TU shaders also support occlusion and parallax textures, but I've not messed with them.

Link to comment
Share on other sites

5 hours ago, alexus said:

2. SolarShader does it work?

Yes, quite well.  It is a subsurface scattering shader, made specifically to facilitate back-lit solar panels, loosely based on this work: https://www.alanzucconi.com/2017/08/30/fast-subsurface-scattering-1/

It produces visuals such as (top two include KS3P post-processing):

w7L6tpJ.png

fMk81V4.png

Earlier version of the shader/textures, but also showing the shader used on the DOS style solar panels.

qsG1Zm0.png

 

Examples for configs can be seen here: https://github.com/shadowmage45/SSTULabs/blob/master/GameData/SSTU-PBR/PBRConversions/DefaultShaderAssignments-DSP-ISS.cfg

5 hours ago, alexus said:

1. Anybody know how I can plug a normal map to existing texture of model?

NRM maps are applied just like any other texture -- use the configs to apply them.  I included examples in my previous post, but will repost the excerpt below.

KSP_MODEL_SHADER
{
	name = CupolaCustomMetallicMap
	//this is the path to the model.mu that you want to adjust, minus the extension
	model = Squad/Parts/Command/cupola/model
	MATERIAL
	{	
		// shader.... pick one...
		shader = SSTU/PBR/MetallicTransparent
		
		//diffuse texture
		texture = _MainTex, pathToYourDIFFTexture
		
		// this points to your metallicGlossMap texture file, relative to the GameData folder;
		texture = _MetallicGlossMap, pathToYourMETTexture
		
		//custom NRM map, disabled by comment
		texture = _BumpMap, pathToYourNRMTexture
		
		//AO texture, disabled by comment
		//texture = _AOMap, pathToYourAOTexture
		
		//emissive texture, disabled by comment
		//texture = _Emissive, pathToYourGLOWTexture
		
		//any other PROPERTY blocks go here
		//... if your textures are created properly you shouldn't need them....	
		//... but they do still have occasional use for special setups and workarounds
	}
}

 

Edited by Shadowmage
Link to comment
Share on other sites

On 9/23/2018 at 7:52 AM, Electrocutor said:

@Shadowmage You may want to update the github wiki to reflect the current syntax. You may also consider adding a spoiler FAQ to the OP to include a bunch of the questions from throughout the thread along with your answer in a formatted way.

Wiki has been updated for the syntax changes, and to add some data points on the newer shaders (solar, transparent).

FAQ -- yeah, likely need to put something together.  Will have to do it on a day where I'm feeling less snarky... as if I were to do it today, it would end up something like:

Q:  <oh.. you have a question?>?
A: IDK -- go read the internets.

 

Link to comment
Share on other sites

Woe is me...I just went to check something and noticed...

Spoiler

FBDEB00C3EDB3AB48CCFB9DC5EEFCDAFBCCE8BDA

When I spotted it I opened the debug menu right away thinking I may have inadvertently loaded my 1.4.1 install but the alternate renderer was already enabled and when exiting the game the main menu said 1.4.5. This is with the latest TU release, 1.1.2.15. and DX11.

Link to comment
Share on other sites

1 minute ago, alexus said:

texture = _BumpMap, pathToYourNRMTexture

If a texture has not default  bump map will this apply it?

Yes -- that will use the texture you specify as a bump map even if the model did not have one previously (and as long as the shader supports it).

4 hours ago, Manwith Noname said:

Woe is me...I just went to check something and noticed...

  Hide contents

FBDEB00C3EDB3AB48CCFB9DC5EEFCDAFBCCE8BDA

When I spotted it I opened the debug menu right away thinking I may have inadvertently loaded my 1.4.1 install but the alternate renderer was already enabled and when exiting the game the main menu said 1.4.5. This is with the latest TU release, 1.1.2.15. and DX11.

Interesting -- I haven't yet run into that issue after I pushed out the alternate-render-mode 'fix'.  Will see if I can repro with DX11.

Link to comment
Share on other sites

hmm, i dont think _MetallicGlossMap likes my metalgloss texture. as long as the smoothness goes to full white it just disappears.
 

Spoiler

AxvgWWc.png

o4POgwE.png

 

and here's the config:

Spoiler

KSP_MODEL_SHADER
{
    name = SQUAD_MK1-3
    
    model = Squad/Parts/Command/Mk1-3Pod/Mk1-3

    TEXTURE
    {
        shader = SSTU/PBR/Metallic
        
        texture = _MainTex, E04_Project-PBR/Squad/Command/MK1-3_ALB
        texture = _MetallicGlossMap, E04_Project-PBR/Squad/Command/MK1-3_MG
        
        excludeMesh = FlagTransform
        excludeMesh = flagTransform
        excludeMesh = FLAG
        excludeMesh = Flag
    }
}

 

EDIT: Nevermind, I figured it out after hours of bashing my head on my desk. I forgot to set this up:

@REFLECTION_CONFIG[default]
{
	%enabled = true
	%resolution = 256
	%interval = 10
	%faces = 6
}

 

Edited by ensou04
Link to comment
Share on other sites

19 hours ago, Shadowmage said:

Yes, quite well.  It is a subsurface scattering shader, made specifically to facilitate back-lit solar panels, loosely based on this work: https://www.alanzucconi.com/2017/08/30/fast-subsurface-scattering-1/

It produces visuals such as (top two include KS3P post-processing):

 

Will you make TU config for solar panel in your mods?

Link to comment
Share on other sites

I finally have a decent base texture to work on. I redid the entire texture of MK1-3 from scratch. i plan to create most of stock parts entirely

 

cant do much with some normals flipping tho :/

Spoiler

xZp2nSs.png

Pg8gdng.png

 

Edited by ensou04
Link to comment
Share on other sites

3 hours ago, alexus said:

Will you make TU config for solar panel in your mods?

If you are asking 'do I make configs for solar panels for my own mods?' -- Yes.  The config that I linked to is for one of the solar panels in SSTU.

If you are asking 'will I make configs for solar panels for other peoples' mods?' No.  Too much drama.  Also, I don't feel like making textures for other peoples' models where I don't have access to the original art assets; it is inefficient and frustrating.

 

 

Link to comment
Share on other sites

1 hour ago, ensou04 said:

I finally have a decent base texture to work on. I redid the entire texture of MK1-3 from scratch. i plan to create most of stock parts entirely

 

cant do much with some normals flipping tho

You had mentioned (prior to an edit?) of using Blender 2.8 for its PBR viewport support for previewing the models.  How well is that all working out?  Would love to have some in-model-editor texture viewing capabilities myself (though... I suppose I should really just transition to SP all the way...).

Link to comment
Share on other sites

22 minutes ago, Shadowmage said:

You had mentioned (prior to an edit?) of using Blender 2.8 for its PBR viewport support for previewing the models.  How well is that all working out?  Would love to have some in-model-editor texture viewing capabilities myself (though... I suppose I should really just transition to SP all the way...).

Oh yeah, i removed the pics because i wasnt so sure about terms of importing models in blender earlier. but yes it works great!

here's a screenshot

Spoiler

K5sejp1.png

 

Link to comment
Share on other sites

1 hour ago, alexus said:

Shadowmage, do you know how I can view files *.mu?

By using Blender ( https://www.blender.org/download/ ), and the .mu import plugin made by Taniwha  ( https://github.com/taniwha/io_object_mu ).

That is the only way that I know of.  .mu files are a proprietary KSP model format, and you won't likely find support in any other software.

Edit:  While not to the same extent as viewing the models in Blender... Sarbian's DebugStuff mod will allow you to view model hierarchy and meshes from within KSP --

 

Edited by Shadowmage
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...