Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Hey there,
Our mod is having some problems with some screwed up vertexes
jA3EA.jpg

So i’m not a map maker myself but i was wondering how i could fix this issue
 
Godarcher said:
Hey there,
Our mod is having some problems with some screwed up vertexes
jA3EA.jpg

So i’m not a map maker myself but i was wondering how i could fix this issue

The vertices need to be manually repositioned to untangle the overlapping and stretched triangles. The mesh needs to be a simple surface with no folds or the engine will overlap textures making the map’s underlying triangles obvious. Could be done in Thorgrims or Blender. The problem may be complicated by insufficient polys to support the coast shape, which might require the addition of more polys - I’d use meshlab for local incremental detail. Presumably you are using a custom sea texture as none of the sea areas look normal.

If you use Thorgrim’s you need to inspect the mesh in wireframe mode (ctrl W). To see the terrain and wireframe as opposed to just the wireframe press ctrl W a second time. To exit wireframe mode just press ctrl W a third time.
 
Hello! I created shader for flags.
Code:
float4 wave_flag(float4 vPosition, float2 vTextureCoord)
{
	vPosition.y += cos(time_var + 15 * vTextureCoord.x) * min(vTextureCoord.x, 0.1) * 1.5; //* (vTextureCoord.x < 0.1 ? vTextureCoord.x : 0.1); //min(vTextureCoord.x, 0.1);
	return vPosition;
}

struct VS_RUSMOD_OUTPUT_FLAG
{
	float4 Pos					: POSITION;
	float  Fog				    : FOG;
	float4 Color				: COLOR0;
	float2 Tex0					: TEXCOORD0;
	float4 SunLight				: TEXCOORD1;
	float4 ShadowTexCoord		: TEXCOORD2;
	float2 ShadowTexelPos		: TEXCOORD3;
};

VS_RUSMOD_OUTPUT_FLAG vs_rusmod_flag(float4 vPosition : POSITION, float3 vNormal : NORMAL, float2 tc : TEXCOORD0, float4 vColor : COLOR0, float4 vLightColor : COLOR1)
{
	INITIALIZE_OUTPUT(VS_RUSMOD_OUTPUT_FLAG, Out);
	
	vPosition = wave_flag(vPosition, tc);
	
	Out.Pos = mul(matWorldViewProj, vPosition);
	float4 vWorldPos = (float4)mul(matWorld,vPosition);
	float3 vWorldN = normalize(mul((float3x3)matWorld, vNormal)); //normal in world space
	Out.Tex0 = tc;
	float4 diffuse_light = vAmbientColor;
	diffuse_light += vLightColor;
	diffuse_light += saturate(dot(vWorldN, -vSkyLightDir)) * vSkyLightColor;
	
	#ifndef USE_LIGHTING_PASS
	diffuse_light += calculate_point_lights_diffuse(vWorldPos, vWorldN, false, false);
	#endif
	
	Out.Color = vMaterialColor * vColor * diffuse_light;

	float wNdotSun = saturate(dot(vWorldN, -vSunDir));
	Out.SunLight = (wNdotSun) * vSunColor * vMaterialColor * vColor;

	float3 P = mul(matWorldView, vPosition); 
	float d = length(P);

	Out.Fog = get_fog_amount_new(d, vWorldPos.z);
	return Out;
}

PS_OUTPUT ps_rusmod_flag(VS_RUSMOD_OUTPUT_FLAG In)
{
	PS_OUTPUT Output;
	float4 tex_col = tex2D(MeshTextureSampler, In.Tex0);
	INPUT_TEX_GAMMA(tex_col.rgb);
	float sun_amount = 1.0f; 
	Output.RGBColor =  tex_col * ((In.Color + In.SunLight * sun_amount));
	OUTPUT_GAMMA(Output.RGBColor.rgb);
	return Output;
}

technique rusmod_flag
{
	pass P0
	{
		VertexShader = compile vs_2_0 vs_rusmod_flag();
		PixelShader = compile ps_2_0 ps_rusmod_flag();
	}
}
Result:

Why is this flag not smooth? And how can I fix it?
 
Janycz said:
Hello! I created shader for flags.
Code:
float4 wave_flag(float4 vPosition, float2 vTextureCoord)
{
	vPosition.y += cos(time_var + 15 * vTextureCoord.x) * min(vTextureCoord.x, 0.1) * 1.5; //* (vTextureCoord.x < 0.1 ? vTextureCoord.x : 0.1); //min(vTextureCoord.x, 0.1);
	return vPosition;
}

struct VS_RUSMOD_OUTPUT_FLAG
{
	float4 Pos					: POSITION;
	float  Fog				    : FOG;
	float4 Color				: COLOR0;
	float2 Tex0					: TEXCOORD0;
	float4 SunLight				: TEXCOORD1;
	float4 ShadowTexCoord		: TEXCOORD2;
	float2 ShadowTexelPos		: TEXCOORD3;
};

VS_RUSMOD_OUTPUT_FLAG vs_rusmod_flag(float4 vPosition : POSITION, float3 vNormal : NORMAL, float2 tc : TEXCOORD0, float4 vColor : COLOR0, float4 vLightColor : COLOR1)
{
	INITIALIZE_OUTPUT(VS_RUSMOD_OUTPUT_FLAG, Out);
	
	vPosition = wave_flag(vPosition, tc);
	
	Out.Pos = mul(matWorldViewProj, vPosition);
	float4 vWorldPos = (float4)mul(matWorld,vPosition);
	float3 vWorldN = normalize(mul((float3x3)matWorld, vNormal)); //normal in world space
	Out.Tex0 = tc;
	float4 diffuse_light = vAmbientColor;
	diffuse_light += vLightColor;
	diffuse_light += saturate(dot(vWorldN, -vSkyLightDir)) * vSkyLightColor;
	
	#ifndef USE_LIGHTING_PASS
	diffuse_light += calculate_point_lights_diffuse(vWorldPos, vWorldN, false, false);
	#endif
	
	Out.Color = vMaterialColor * vColor * diffuse_light;

	float wNdotSun = saturate(dot(vWorldN, -vSunDir));
	Out.SunLight = (wNdotSun) * vSunColor * vMaterialColor * vColor;

	float3 P = mul(matWorldView, vPosition); 
	float d = length(P);

	Out.Fog = get_fog_amount_new(d, vWorldPos.z);
	return Out;
}

PS_OUTPUT ps_rusmod_flag(VS_RUSMOD_OUTPUT_FLAG In)
{
	PS_OUTPUT Output;
	float4 tex_col = tex2D(MeshTextureSampler, In.Tex0);
	INPUT_TEX_GAMMA(tex_col.rgb);
	float sun_amount = 1.0f; 
	Output.RGBColor =  tex_col * ((In.Color + In.SunLight * sun_amount));
	OUTPUT_GAMMA(Output.RGBColor.rgb);
	return Output;
}

technique rusmod_flag
{
	pass P0
	{
		VertexShader = compile vs_2_0 vs_rusmod_flag();
		PixelShader = compile ps_2_0 ps_rusmod_flag();
	}
}
Result:

Why is this flag not smooth? And how can I fix it?

It looks like your flag has too few polys. It can only bend where there are vertices. To make it look smooth you need to subdivide the mesh in Blender to create more faces/polys. The picture suggests you only have about five columns of polys, which is far too few.
 
NPC99 said:
It looks like your flag has too few polys. It can only bend where there are vertices. To make it look smooth you need to subdivide the mesh in Blender to create more faces/polys. The picture suggests you only have about five columns of polys, which is far too few.
Thanks, NPC99.
Can I do needed splitting in OpenBRF?
I do not know how do this in blender. In general, I do not know how do anything in blender.

I changed formula to vPosition.y += cos(6 * time_var + 5 * vTextureCoord.x) * min(vTextureCoord.x, 0.5) * 0.4;
Now, the flag is looking smooth (almost, because folmula has a little defect, because I was too lazy to make the correct problem (correct in Hadamard's meaning) for the wave equation and use the D'Alembert's Kirchhoff's Poisson's formula).
 
Does anybody know of a method to be able to zoom out further on the world map overview?
Edit: map_max_distance does just that for < 251

Where are defender troops assigned to towns? (So its possible to give towns more defenders)
edit: for people searching they are assigned reinforcements, increase the faction_reinforcement points troop amounts to increase this
 
Hello all, how to prevent AI musicians and colour bearers from randomizing their hair and beards in Napoleonic Wars DLC? I created new faces in the face generator, added them to the list of faces in module_troops and assigned them to AI troops and troops. Infantry bots spawn with correct faces, but musicians and colour bearers (in the commander battle mode) spawn with random face textures, hairstyles and beards.
 
Are map icons able to work with seperated meshes?
OQLDP.png

i got a new map icon however it is textured in 6 layers, combining the mesh makes it kind of ugly and i really one preserve the subtle texture changes.
i tried using seperated meshes, city, city.1, city.2 but it just loads one of them onto the world map, while this method works fine with a normal helmet
 
Godarcher said:
Does anybody know of a method to be able to zoom out further on the world map overview?
Edit: map_max_distance does just that for < 251

Where are defender troops assigned to towns? (So its possible to give towns more defenders)
edit: for people searching they are assigned reinforcements, increase the faction_reinforcement points troop amounts to increase this

You can try to just make global map smaller, and also make icons smaller and reduce travelling speed
 
Godarcher said:
Are map icons able to work with seperated meshes?
OQLDP.png

i got a new map icon however it is textured in 6 layers, combining the mesh makes it kind of ugly and i really one preserve the subtle texture changes.
i tried using seperated meshes, city, city.1, city.2 but it just loads one of them onto the world map, while this method works fine with a normal helmet

I suggest you combine your textures so they can work with a single mesh. The following shows how to do it with four textures in OpenBRF:

mtarini said:
You can but you have to suffer a bit and also prepare the textures themselves yourself.

The tool you are looking is "Transform texture coordinates"
For example, to assemble 4 sheets into one sheet like this:

A B
C D

then all the models should be scaled by 50% (both U and V).
meshes originally using A should not be translated.
meshes originally using B should be translated by 0.5 in U (horizontal)
meshes originally using C should be translated by 0.5 in V (vertical).
meshes originally using D should be translated by 0.5 both in U and in V.

Now, all these meshes must be using the material linked to the new assembled texture.

Or you could re-uv map a composite texture in Blender.
 
You should really reconstruct that map icon - flatten all the buildings inside except the ziggurat by taking a screenshot from above and filling the walls with a planar mesh, then probably map all the towers to the same atlas etc. Basically players are going to see the middle building and go yep, that's a big city.
 
NPC99 said:
Godarcher said:
Are map icons able to work with seperated meshes?
OQLDP.png

i got a new map icon however it is textured in 6 layers, combining the mesh makes it kind of ugly and i really one preserve the subtle texture changes.
i tried using seperated meshes, city, city.1, city.2 but it just loads one of them onto the world map, while this method works fine with a normal helmet

I suggest you combine your textures so they can work with a single mesh. The following shows how to do it with four textures in OpenBRF:

mtarini said:
You can but you have to suffer a bit and also prepare the textures themselves yourself.

The tool you are looking is "Transform texture coordinates"
For example, to assemble 4 sheets into one sheet like this:

A B
C D

then all the models should be scaled by 50% (both U and V).
meshes originally using A should not be translated.
meshes originally using B should be translated by 0.5 in U (horizontal)
meshes originally using C should be translated by 0.5 in V (vertical).
meshes originally using D should be translated by 0.5 both in U and in V.

Now, all these meshes must be using the material linked to the new assembled texture.

Or you could re-uv map a composite texture in Blender.

I'm not a modellor by default so i'm having quite a hard time doing this.
If i do the transformation how should i then do my textures in the
AB
CD
position in one single file?
position, cause i tried that and it didn't quite work out
 
Godarcher said:
NPC99 said:
Godarcher said:
Are map icons able to work with seperated meshes?
OQLDP.png
i got a new map icon however it is textured in 6 layers, combining the mesh makes it kind of ugly and i really one preserve the subtle texture changes.
i tried using seperated meshes, city, city.1, city.2 but it just loads one of them onto the world map, while this method works fine with a normal helmet

I suggest you combine your textures so they can work with a single mesh. The following shows how to do it with four textures in OpenBRF:

mtarini said:
You can but you have to suffer a bit and also prepare the textures themselves yourself.

The tool you are looking is "Transform texture coordinates"
For example, to assemble 4 sheets into one sheet like this:

A B
C D

then all the models should be scaled by 50% (both U and V).
meshes originally using A should not be translated.
meshes originally using B should be translated by 0.5 in U (horizontal)
meshes originally using C should be translated by 0.5 in V (vertical).
meshes originally using D should be translated by 0.5 both in U and in V.

Now, all these meshes must be using the material linked to the new assembled texture.

Or you could re-uv map a composite texture in Blender.

I'm not a modellor by default so i'm having quite a hard time doing this.
If i do the transformation how should i then do my textures in the
AB
CD
position in one single file?
position, cause i tried that and it didn't quite work out

The technique is illustrated in more detail inside this tutorial on animated map icons: https://forums.taleworlds.com/index.php/topic,376980.0.html
 
Status
Not open for further replies.
Back
Top Bottom