Page 4 of 11

Re: Few serious questions for Ogre-Next, moving Stunt Rally

Posted: Fri Feb 24, 2023 12:01 am
by dark_sylinc

Mmm, this is a problem of "how many vertices the scene" vs "how many vertices are being pushed to the GPU" question.

PassSceneDef passes would need a new flag to indicate they don't want to increase the counters.

Crystal Hammer wrote: Wed Feb 22, 2023 8:36 pm

Shadows aren't included in render stats, so I wouldn't expect rendered cubemaps either.

AFAIK shadows contribute their render stats. I suspect that must be happening is that Terrain isn't actually rendered in shadow maps (because it uses its own Compute solution) except for point & spot lights; thus it appears like shadows are not contributing their stats (they are, it's just that they are not rendered as many vertices, if any).


Re: Few serious questions for Ogre-Next, moving Stunt Rally

Posted: Fri Feb 24, 2023 9:04 pm
by Crystal Hammer

Ah I see.
Okay so how about a way to get render stats for each compositor_node and pass?
This way I'd know exactly what I want to check (like before), for pass render_scene from SR3_Render node.
And I could also check reflection cube (or shadows) by getting stats for its node if needed.


Re: Few serious questions for Ogre-Next, moving Stunt Rally

Posted: Sun Feb 26, 2023 3:04 pm
by Crystal Hammer

Since the terrain triplanar was merged I am observing an issue, both in
terrain sample and in my editor
terrain goes dark when looking away from sun, down to terrain.
Happens with and without triplanar, same.
Maybe this happened because of the move of some blocks in shader earlier IDK.


Re: Few serious questions for Ogre-Next, moving Stunt Rally

Posted: Fri Mar 03, 2023 7:50 pm
by dark_sylinc

I forgot to checkout your videos.

I can repro your problems. There's definitely something wrong.


Re: Few serious questions for Ogre-Next, moving Stunt Rally

Posted: Fri Mar 03, 2023 9:06 pm
by dark_sylinc

Pushed a fix.

Thanks for bringing this to my attention.


Re: Few serious questions for Ogre-Next, moving Stunt Rally

Posted: Sun Mar 05, 2023 7:40 pm
by Crystal Hammer

Great, thanks for fixing it. I see it working now in Sample_Terrain.
I added also this line for Normals
datablock->setDetailTriplanarNormalEnabled( mTriplanarMappingEnabled );
after that
datablock->setDetailTriplanarDiffuseEnabled( mTriplanarMappingEnabled );
and it works in Sample_Terrain.

But strangely when I do that in StuntRally I get a weird shader error that tells me nothing:

Code: Select all

19:17:55: GLSL compile log: 700000024PixelShader_ps
0:724(31): error: syntax error, unexpected NEW_IDENTIFIER
19:17:55: OGRE EXCEPTION(3:RenderingAPIException): Fragment Program 700000024PixelShader_ps failed to compile. See compile log above for details. in GLSLShader::compile at ../../RenderSystems/GL3Plus/src/GLSL/OgreGLSLShader.cpp (line 313)

The line 724 in 700000024PixelShader_ps.glsl has this:

Code: Select all

midf3 SampleDetailMapNm0SdFn( Texture2DArray tex, SamplerState smp, midf2 uv, uint arrayIdx, midf4 weights, midf3 normal )

So it only works with setDetailTriplanarDiffuseEnabled(true); in StuntRally for some strange reason.
I looked few times already to check if I merged all shaders after updates and I believe they're okay, not that many anyway.
It'd be great if someone helped, I don't even get what is error complaining about. I checked this shader with version that has no triplanar normals and IDK what to look for, it has many changes.

I'm attaching failing shader:

700000024PixelShader_ps-error.glsl
(47.79 KiB) Downloaded 1445 times

and the same one, which works, but without triplanar normals

700000023PixelShader_ps-ok.glsl
(48.47 KiB) Downloaded 1493 times

Re: Few serious questions for Ogre-Next, moving Stunt Rally

Posted: Sun Mar 05, 2023 8:26 pm
by dark_sylinc

Could you please try this patch?

Code: Select all

diff --git a/Samples/Media/Hlms/Terra/Any/550.DetailTriplanar_piece_ps.any b/Samples/Media/Hlms/Terra/Any/550.DetailTriplanar_piece_ps.any
index 3baaa2c81c..cf94d95b6f 100644
--- a/Samples/Media/Hlms/Terra/Any/550.DetailTriplanar_piece_ps.any
+++ b/Samples/Media/Hlms/Terra/Any/550.DetailTriplanar_piece_ps.any
@@ -65,12 +65,31 @@
 		}
 
	@foreach( detail_maps_normal, n )@property( detail_map_nm@n )
-			#define SampleDetailMapNm@nSd( tex, sampler, uv, arrayIdx ) SampleDetailMapNm@nSdFn( tex, sampler, uv, arrayIdx, detailWeights, pixelData.worldSpaceNormal )
-			#define SampleDetailMapNm@nTp( tex, sampler, uv, arrayIdx ) SampleDetailMapNm@nTpFn( tex, sampler, uv, arrayIdx, detailWeights, pixelData.worldSpaceNormal )
-			#define SampleDetailMapNm@nFr( tex, sampler, uv, arrayIdx ) SampleDetailMapNm@nFrFn( tex, sampler, uv, arrayIdx, detailWeights, pixelData.worldSpaceNormal )
+			@property( syntax != glsl )
+				#define SampleDetailMapNm@nSd( tex, sampler, uv, arrayIdx ) SampleDetailMapNm@nSdFn( tex, sampler, uv, arrayIdx, detailWeights, pixelData.normal )
+				#define SampleDetailMapNm@nTp( tex, sampler, uv, arrayIdx ) SampleDetailMapNm@nTpFn( tex, sampler, uv, arrayIdx, detailWeights, pixelData.normal )
+				#define SampleDetailMapNm@nFr( tex, sampler, uv, arrayIdx ) SampleDetailMapNm@nFrFn( tex, sampler, uv, arrayIdx, detailWeights, pixelData.normal )
+			@else
+				#define SampleDetailMapNm@nSd( tex, sampler, uv, arrayIdx ) SampleDetailMapNm@nSdFn( tex, uv, arrayIdx, detailWeights, pixelData.normal )
+				#define SampleDetailMapNm@nTp( tex, sampler, uv, arrayIdx ) SampleDetailMapNm@nTpFn( tex, uv, arrayIdx, detailWeights, pixelData.normal )
+				#define SampleDetailMapNm@nFr( tex, sampler, uv, arrayIdx ) SampleDetailMapNm@nFrFn( tex, uv, arrayIdx, detailWeights, pixelData.normal )
+			@end
 
	// Side view projection
-			midf3 SampleDetailMapNm@nSdFn( Texture2DArray tex, SamplerState smp, midf2 uv, uint arrayIdx, midf4 weights, midf3 normal )
+			midf3 SampleDetailMapNm@nSdFn(
+				@property( syntax == glsl )
+					sampler2DArray tex
+				@end
+				@property( syntax == glslvk )
+					sampler2DArray tex, sampler smp,
+				@end
+				@property( syntax == hlsl )
+					Texture2DArray tex, SamplerState smp,
+				@end
+				@property( syntax == metal )
+					texture2d_array<midf> tex, sampler smp,
+				@end
+					midf2 uv, uint arrayIdx, midf4 weights, midf3 normal )
 			{
 				midf3 tangentNormal = getTSNormal( tex, smp, uv, arrayIdx ) * weights.@insertpiece( detail_swizzle@n );
 
@@ -86,7 +105,20 @@
 			}
 
		// Top view projection
-			midf3 SampleDetailMapNm@nTpFn( Texture2DArray tex, SamplerState smp, midf2 uv, uint arrayIdx, midf4 weights, midf3 normal )
+			midf3 SampleDetailMapNm@nTpFn(
+				@property( syntax == glsl )
+					sampler2DArray tex
+				@end
+				@property( syntax == glslvk )
+					sampler2DArray tex, sampler smp,
+				@end
+				@property( syntax == hlsl )
+					Texture2DArray tex, SamplerState smp,
+				@end
+				@property( syntax == metal )
+					texture2d_array<midf> tex, sampler smp,
+				@end
+					midf2 uv, uint arrayIdx, midf4 weights, midf3 normal )
 			{
 				midf3 tangentNormal = getTSNormal( tex, smp, uv, arrayIdx ) * weights.@insertpiece( detail_swizzle@n );
 				tangentNormal.y = -tangentNormal.y;
@@ -98,7 +130,20 @@
 			}
 
	// Front view projection
-			midf3 SampleDetailMapNm@nFrFn( Texture2DArray tex, SamplerState smp, midf2 uv, uint arrayIdx, midf4 weights, midf3 normal )
+			midf3 SampleDetailMapNm@nFrFn(
+				@property( syntax == glsl )
+					sampler2DArray tex
+				@end
+				@property( syntax == glslvk )
+					sampler2DArray tex, sampler smp,
+				@end
+				@property( syntax == hlsl )
+					Texture2DArray tex, SamplerState smp,
+				@end
+				@property( syntax == metal )
+					texture2d_array<midf> tex, sampler smp,
+				@end
+					midf2 uv, uint arrayIdx, midf4 weights, midf3 normal )
 			{
 				midf3 tangentNormal = getTSNormal( tex, smp, uv, arrayIdx ) * weights.@insertpiece( detail_swizzle@n );
 

It would appear the code miscompiles when targetting anything else other than HLSL.


Re: Few serious questions for Ogre-Next, moving Stunt Rally

Posted: Sun Mar 05, 2023 9:28 pm
by Crystal Hammer

Allright, it almost works.
Had to add a comma at end after tex

Code: Select all

+				@property( syntax == glsl )
+					sampler2DArray tex,
+				@end

The bad thing is this sudden white "specular" stuff, and no I don't have snow lying here yet :) .
Here is without triplanar normals:

05_21-22-19s.jpg
05_21-22-19s.jpg (235.87 KiB) Viewed 81632 times

and with:

05_21-22-45s.jpg
05_21-22-45s.jpg (242.02 KiB) Viewed 81632 times

I think it also darkened non specular shadow places.
Ah and I'm not using terrain shadow map (it broke for me) since I got still unnormalized, any floats in heightmap.
Also I do use tdb->setBrdf(TerraBrdf::BlinnPhongLegacyMath); since it seems to at least have some specular, I have no roughness or metalness maps.
Here is the final shader (I think it's always the last file), I left the original lines commented out:

700000019PixelShader_ps.glsl
(61.07 KiB) Downloaded 1579 times

Re: Few serious questions for Ogre-Next, moving Stunt Rally

Posted: Mon Mar 06, 2023 3:56 am
by dark_sylinc

Thanks for the fix!

Try this patch then:

Code: Select all

diff --git a/Samples/Media/Hlms/Terra/Any/550.DetailTriplanar_piece_ps.any b/Samples/Media/Hlms/Terra/Any/550.DetailTriplanar_piece_ps.any
index 3baaa2c81c..bee106a5c4 100644
--- a/Samples/Media/Hlms/Terra/Any/550.DetailTriplanar_piece_ps.any
+++ b/Samples/Media/Hlms/Terra/Any/550.DetailTriplanar_piece_ps.any
@@ -65,12 +65,31 @@
 		}
 
	@foreach( detail_maps_normal, n )@property( detail_map_nm@n )
-			#define SampleDetailMapNm@nSd( tex, sampler, uv, arrayIdx ) SampleDetailMapNm@nSdFn( tex, sampler, uv, arrayIdx, detailWeights, pixelData.worldSpaceNormal )
-			#define SampleDetailMapNm@nTp( tex, sampler, uv, arrayIdx ) SampleDetailMapNm@nTpFn( tex, sampler, uv, arrayIdx, detailWeights, pixelData.worldSpaceNormal )
-			#define SampleDetailMapNm@nFr( tex, sampler, uv, arrayIdx ) SampleDetailMapNm@nFrFn( tex, sampler, uv, arrayIdx, detailWeights, pixelData.worldSpaceNormal )
+			@property( syntax != glsl )
+				#define SampleDetailMapNm@nSd( tex, sampler, uv, arrayIdx ) SampleDetailMapNm@nSdFn( tex, sampler, uv, arrayIdx, detailWeights, pixelData.normal )
+				#define SampleDetailMapNm@nTp( tex, sampler, uv, arrayIdx ) SampleDetailMapNm@nTpFn( tex, sampler, uv, arrayIdx, detailWeights, pixelData.normal )
+				#define SampleDetailMapNm@nFr( tex, sampler, uv, arrayIdx ) SampleDetailMapNm@nFrFn( tex, sampler, uv, arrayIdx, detailWeights, pixelData.normal )
+			@else
+				#define SampleDetailMapNm@nSd( tex, sampler, uv, arrayIdx ) SampleDetailMapNm@nSdFn( tex, uv, arrayIdx, detailWeights, pixelData.normal )
+				#define SampleDetailMapNm@nTp( tex, sampler, uv, arrayIdx ) SampleDetailMapNm@nTpFn( tex, uv, arrayIdx, detailWeights, pixelData.normal )
+				#define SampleDetailMapNm@nFr( tex, sampler, uv, arrayIdx ) SampleDetailMapNm@nFrFn( tex, uv, arrayIdx, detailWeights, pixelData.normal )
+			@end
 
	// Side view projection
-			midf3 SampleDetailMapNm@nSdFn( Texture2DArray tex, SamplerState smp, midf2 uv, uint arrayIdx, midf4 weights, midf3 normal )
+			midf3 SampleDetailMapNm@nSdFn(
+				@property( syntax == glsl )
+					sampler2DArray tex,
+				@end
+				@property( syntax == glslvk )
+					sampler2DArray tex, sampler smp,
+				@end
+				@property( syntax == hlsl )
+					Texture2DArray tex, SamplerState smp,
+				@end
+				@property( syntax == metal )
+					texture2d_array<midf> tex, sampler smp,
+				@end
+					midf2 uv, uint arrayIdx, midf4 weights, midf3 normal )
 			{
 				midf3 tangentNormal = getTSNormal( tex, smp, uv, arrayIdx ) * weights.@insertpiece( detail_swizzle@n );
 
@@ -86,7 +105,20 @@
 			}
 
		// Top view projection
-			midf3 SampleDetailMapNm@nTpFn( Texture2DArray tex, SamplerState smp, midf2 uv, uint arrayIdx, midf4 weights, midf3 normal )
+			midf3 SampleDetailMapNm@nTpFn(
+				@property( syntax == glsl )
+					sampler2DArray tex,
+				@end
+				@property( syntax == glslvk )
+					sampler2DArray tex, sampler smp,
+				@end
+				@property( syntax == hlsl )
+					Texture2DArray tex, SamplerState smp,
+				@end
+				@property( syntax == metal )
+					texture2d_array<midf> tex, sampler smp,
+				@end
+					midf2 uv, uint arrayIdx, midf4 weights, midf3 normal )
 			{
 				midf3 tangentNormal = getTSNormal( tex, smp, uv, arrayIdx ) * weights.@insertpiece( detail_swizzle@n );
 				tangentNormal.y = -tangentNormal.y;
@@ -98,7 +130,20 @@
 			}
 
	// Front view projection
-			midf3 SampleDetailMapNm@nFrFn( Texture2DArray tex, SamplerState smp, midf2 uv, uint arrayIdx, midf4 weights, midf3 normal )
+			midf3 SampleDetailMapNm@nFrFn(
+				@property( syntax == glsl )
+					sampler2DArray tex,
+				@end
+				@property( syntax == glslvk )
+					sampler2DArray tex, sampler smp,
+				@end
+				@property( syntax == hlsl )
+					Texture2DArray tex, SamplerState smp,
+				@end
+				@property( syntax == metal )
+					texture2d_array<midf> tex, sampler smp,
+				@end
+					midf2 uv, uint arrayIdx, midf4 weights, midf3 normal )
 			{
 				midf3 tangentNormal = getTSNormal( tex, smp, uv, arrayIdx ) * weights.@insertpiece( detail_swizzle@n );
 
@@ -156,20 +201,24 @@
 
 
 @piece( SampleAndApplyDetailNormalMapsTriplanar )
+	// pixelData.normal will becomputed via triplanar mapping, and will be in world space
+	// (later we convert it to view space)
+	pixelData.normal = pixelData.worldSpaceNormal;
 	@foreach( detail_maps_normal, n )@property( detail_map_nm@n )
 		pixelData.normal = SampleDetailMapNm@nSd( textureMaps@value( detail_map_nm@n_idx ),
 												  samplerState@value( detail_map_nm@n_sampler ),
-												  UV_DETAIL_NM@n( GetTriplanarUVSd( inPs.worldPos, pixelData.worldSpaceNormal )@insertpiece( offsetDetail@n ) ),
+												  UV_DETAIL_NM@n( GetTriplanarUVSd( inPs.worldPos, pixelData.normal )@insertpiece( offsetDetail@n ) ),
 												  texIndex_detailNormMapIdx@n ) * triplanarBlend.x +
 
				   SampleDetailMapNm@nTp( textureMaps@value( detail_map_nm@n_idx ),
										  samplerState@value( detail_map_nm@n_sampler ),
-												  UV_DETAIL_NM@n( GetTriplanarUVTp( inPs.worldPos, pixelData.worldSpaceNormal )@insertpiece( offsetDetail@n ) ),
+												  UV_DETAIL_NM@n( GetTriplanarUVTp( inPs.worldPos, pixelData.normal )@insertpiece( offsetDetail@n ) ),
 												  texIndex_detailNormMapIdx@n ) * triplanarBlend.y +
 
				   SampleDetailMapNm@nFr( textureMaps@value( detail_map_nm@n_idx ),
										  samplerState@value( detail_map_nm@n_sampler ),
-												  UV_DETAIL_NM@n( GetTriplanarUVFr( inPs.worldPos, pixelData.worldSpaceNormal )@insertpiece( offsetDetail@n ) ),
+												  UV_DETAIL_NM@n( GetTriplanarUVFr( inPs.worldPos, pixelData.normal )@insertpiece( offsetDetail@n ) ),
 												  texIndex_detailNormMapIdx@n ) * triplanarBlend.z;
 	@end @end
+	pixelData.worldSpaceNormal = pixelData.normal;
 @end

Btw I noticed the version you sent me was incorrectly patched. You had:

Code: Select all

// #define SampleDetailMapNm0Sd( tex, sampler, uv, arrayIdx ) SampleDetailMapNm0SdFn( tex, sampler, uv, arrayIdx, detailWeights, pixelData.worldSpaceNormal )
#define SampleDetailMapNm0Sd( tex, sampler, uv, arrayIdx ) SampleDetailMapNm0SdFn( tex, uv, arrayIdx, detailWeights, pixelData.normal )

Notice the commented out version used pixelData.worldSpaceNormal while your patched version uses pixelData.normal.

Anyway, I changed this since you made me notice something. In Raphaelle's intended version, pixelData.normal would be calculated using triplanar and then later the rest of the maps would be using triplanar using that normal, instead of the geometric normal.

Ours was using the geometric normal.

So I fixed that.

and no I don't have snow lying here yet :) .

That's not a bug, it's a feature! :lol:


Re: Few serious questions for Ogre-Next, moving Stunt Rally

Posted: Mon Mar 06, 2023 9:30 pm
by Crystal Hammer

Okay it changed, and then I also added + line

Code: Select all

@piece( SampleAndApplyDetailNormalMapsTriplanar )
...
+     pixelData.normal = normalize( pixelData.normal );
@end @end

and with this, I don't see snow, i.e those extra white spots.
But I see still those darkened places on terrain, which aren't present without normals triplanar.
Made a video with quick test in 2 places in SR3 Track Editor, with: 0 no triplanar, 1 Diffuse triplanar only, 2 Diffuse+Normals and those dark spots.


Re: Few serious questions for Ogre-Next, moving Stunt Rally

Posted: Mon Mar 06, 2023 11:43 pm
by dark_sylinc

So you still see "snow" without the normalization?


Re: Few serious questions for Ogre-Next, moving Stunt Rally

Posted: Tue Mar 07, 2023 1:47 am
by Crystal Hammer

Yes


Re: Few serious questions for Ogre-Next, moving Stunt Rally

Posted: Mon Mar 13, 2023 7:06 pm
by Crystal Hammer

So no more hints on that normals issue? I wonder if it's my setup's fault, didn't see it in Ogre sample.

Anyways I got an issue with that v2 to v1, v1 buildTangentVectors, v1 to v2 mesh procedure. It does throw in Debug:

Code: Select all

sr-editor3: ../../RenderSystems/GL3Plus/src/OgreGL3PlusHardwareVertexBuffer.cpp:86: virtual void* Ogre::v1::GL3PlusHardwareVertexBuffer::lockImpl(size_t, size_t, Ogre::v1::HardwareBuffer::LockOptions): Assertion `( ( mUsage & HBU_WRITE_ONLY && options != HBL_NORMAL && options != HBL_READ_ONLY ) || !( mUsage & HBU_WRITE_ONLY ) ) && "Reading from a write-only buffer! Create the buffer without HBL_WRITE_ONLY bit"' failed.

call stack:

Code: Select all

__GI_raise (@raise:51)
__GI_abort (@abort:64)
__assert_fail_base (@_nl_load_domain.cold:3)
__GI___assert_fail (@7ffff698f662..7ffff698f6eb:3)
Ogre::v1::GL3PlusHardwareVertexBuffer::lockImpl(unsigned long, unsigned long, Ogre::v1::HardwareBuffer::LockOptions) (/home/ch/_sr/og3/Ogre/ogre-next/RenderSystems/GL3Plus/src/OgreGL3PlusHardwareVertexBuffer.cpp:86)
Ogre::v1::HardwareBuffer::lock(unsigned long, unsigned long, Ogre::v1::HardwareBuffer::LockOptions) (/home/ch/_sr/og3/Ogre/ogre-next/OgreMain/include/OgreHardwareBuffer.h:218)
Ogre::v1::HardwareBuffer::lock(Ogre::v1::HardwareBuffer::LockOptions) (/home/ch/_sr/og3/Ogre/ogre-next/OgreMain/include/OgreHardwareBuffer.h:230)
Ogre::v1::HardwareBufferLockGuard::lock(Ogre::v1::HardwareBuffer*, Ogre::v1::HardwareBuffer::LockOptions) (/home/ch/_sr/og3/Ogre/ogre-next/OgreMain/include/OgreHardwareBuffer.h:412)
void Ogre::v1::HardwareBufferLockGuard::lock<Ogre::v1::HardwareVertexBuffer>(Ogre::SharedPtr<Ogre::v1::HardwareVertexBuffer> const&, Ogre::v1::HardwareBuffer::LockOptions) (/home/ch/_sr/og3/Ogre/ogre-next/OgreMain/include/OgreHardwareBuffer.h:426)
Ogre::v1::TangentSpaceCalc::populateVertexArray(unsigned short) (/home/ch/_sr/og3/Ogre/ogre-next/OgreMain/src/OgreTangentSpaceCalc.cpp:530)
Ogre::v1::TangentSpaceCalc::build(Ogre::VertexElementSemantic, unsigned short, unsigned short) (/home/ch/_sr/og3/Ogre/ogre-next/OgreMain/src/OgreTangentSpaceCalc.cpp:81)
Ogre::v1::Mesh::buildTangentVectors(Ogre::VertexElementSemantic, unsigned short, unsigned short, bool, bool, bool) (/home/ch/_sr/og3/Ogre/ogre-next/OgreMain/src/OgreMesh.cpp:1719)
SplineRoad::CreateMesh(SegData&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, bool, std::vector<Ogre::Vector3, std::allocator<Ogre::Vector3> > const&, std::vector<Ogre::Vector3, std::allocator<Ogre::Vector3> > const&, std::vector<Ogre::Vector4, std::allocator<Ogre::Vector4> > const&, std::vector<Ogre::Vector2, std::allocator<Ogre::Vector2> > const&, std::vector<unsigned short, std::allocator<unsigned short> > const&) (/home/ch/_sr/og3/_sr/src/road/Road_Mesh.cpp:211)
SplineRoad::createSeg_Meshes(SplineRoad::DataLod const&, SplineRoad::DataLodMesh const&, SplineRoad::DataSeg&, RoadSeg&) (/home/ch/_sr/og3/_sr/src/road/Road_Rebuild.cpp:594)
SplineRoad::BuildSeg(SplineRoad::DataRoad const&, SplineRoad::DataLod0 const&, SplineRoad::DataLod&, SplineRoad::StatsLod&, SplineRoad::DataLodMesh&, SplineRoad::DataSeg&, int, bool) (/home/ch/_sr/og3/_sr/src/road/Road_Rebuild.cpp:467)
SplineRoad::RebuildRoadInt(bool, bool) (/home/ch/_sr/og3/_sr/src/road/Road_Prepass.cpp:122)
App::UpdateEnd(float) (/home/ch/_sr/og3/_sr/src/editor/Update_Frame.cpp:219)
App::update(float) (/home/ch/_sr/og3/_sr/src/editor/Update_Frame.cpp:403)
BaseSystem::update(float) (/home/ch/_sr/og3/_sr/src/OgreCommon/BaseSystem.cpp:44)
GraphicsSystem::update(float) (/home/ch/_sr/og3/_sr/src/OgreCommon/GraphicsSystem.cpp:471)

Is this my fault or an issue in Ogre? Does it mean tangents are broken in Release then, even if it doesn't throw?
Do I need binormals too? Or just normal and tangent in mesh v2? Is this what's needed for it in code then?

Code: Select all

	vertexElements.push_back( VertexElement2( VET_FLOAT3, VES_POSITION ) );  vertSize += 3;
	vertexElements.push_back( VertexElement2( VET_FLOAT3, VES_NORMAL ) );    vertSize += 3;
	vertexElements.push_back( VertexElement2( VET_FLOAT3, VES_TANGENT ) );    vertSize += 3;
	vertexElements.push_back( VertexElement2( VET_FLOAT3, VES_BINORMAL ) );    vertSize += 3;
	vertexElements.push_back( VertexElement2( VET_FLOAT2, VES_TEXTURE_COORDINATES) );  vertSize += 2;

Because I actually tried this (with and w/o binormal) and I end with broken meshes, positions go into space and road looks like random garbage. Also tried with FLOAT2 for those, garbage too. I didn't fill real tangent/binormal values, but anything there shouldn't destroy mesh positions right?

Other thing, do you know what in Terra depends on heighmap floats being 0 to 1?

  • I think shadowmap generation works but it has always full shadow below 0.f heights?
  • Skirt seems working. I think I made it const height (relative to terrain surface) in Media/Hlms/Terra/Any/800.VertexShader_piece_vs.any

    Code: Select all

    @property( use_skirts )
    	float skirtHeight = uintBitsToFloat( cellData.numVertsPerLine.w );
    	if( isSkirt )
    	{
    		worldPos.y -= 10.0;
    		// comment out what was here
    	}
  • And page visibility also breaks with any floats. That's why I disabled that and shadowmap long ago, but I need to get it back someday soon.

Is it really a difference if I use floats not 0..1 in shaders? These are floats (not halfs) on PC GPUs right?


Re: Few serious questions for Ogre-Next, moving Stunt Rally

Posted: Sun Mar 26, 2023 11:17 pm
by Crystal Hammer

Okay, I feel like again my issues (from my previous posts here) have been not seen or worse forgotten.
My old question of communication on this forum is also not answered. I basically don't know if after my post:

  • you missed it
  • you're just too busy with other stuff or don't have time ATM (since I see more recent forum topics also not answered)
  • something seems like just my problem, so no answer (and good luck finding it on your own)
  • or something is not a priority (for any reason)

Yeah I know this isn't IT support, just forum. So no ticket for each issue and guaranteed response in few days.
But still, it's hard for me to guess after 2 weeks and IDK if I should just bump my remaining questions once a while? Some info would be cool. Also I try to post only major issues that I don't know how to get going.

So back to V2 tangents.
I don't see an easy way I could quickly test in Ogre-Next creating V2 mesh from code, not by importing from V1, and setting tangents by code also (binormals too?).
If there was I'd know if I messed something or there is a bug and this offset isn't my code fault.
My code is here and if I undef V1tangents I get weird mesh like some offset in pos buffer or something. Screen with this mess here

0180`s.jpg
0180`s.jpg (204.32 KiB) Viewed 81371 times

Now a new issue, I did recently add Planar Reflections code form samples to SR and strangely I see only 1 reflection on unlit plane (right), the PBR plane (on left) has no reflection, but some white looking texture (while blue in reflected in unlit), this doesn't look at all like in sample. Any hints on how to investigate this? I see nothing wrong in log.

26_20-53-08`.jpg
26_20-53-08`.jpg (174.33 KiB) Viewed 81371 times

Re: Few serious questions for Ogre-Next, moving Stunt Rally

Posted: Sun Mar 26, 2023 11:39 pm
by dark_sylinc

You have a lot of problems and it is hard to focus on just one.

Also errors like these:

Code: Select all

sr-editor3: ../../RenderSystems/GL3Plus/src/OgreGL3PlusHardwareVertexBuffer.cpp:86: virtual void* Ogre::v1::GL3PlusHardwareVertexBuffer::lockImpl(size_t, size_t, Ogre::v1::HardwareBuffer::LockOptions): Assertion `( ( mUsage & HBU_WRITE_ONLY && options != HBL_NORMAL && options != HBL_READ_ONLY ) || !( mUsage & HBU_WRITE_ONLY ) ) && "Reading from a write-only buffer! Create the buffer without HBL_WRITE_ONLY bit"' failed.

Will get you a lot of hits in the forums.

Looking at your code you must first change your mVertexBufferUsage and mIndexBufferUsage before importing:

Code: Select all

m1->setVertexBufferPolicy( HardwareBuffer::HBU_STATIC, false ); // setting it to true may decrease loading time. Profile.
m1->setIndexBufferPolicy( HardwareBuffer::HBU_STATIC, false ); // setting it to true may decrease loading time. Profile.
m1->importV2(mesh.get());
if (!trail)
    m1->buildTangentVectors();

As for the rest, if you make a youtube video on how to build your code from scratch on Linux and repro the most prominent bugs perhaps I could just look at it myself.


Re: Few serious questions for Ogre-Next, moving Stunt Rally

Posted: Mon Mar 27, 2023 1:24 am
by Crystal Hammer

All right, thanks. I will do it.


Re: Few serious questions for Ogre-Next, moving Stunt Rally

Posted: Sun Apr 02, 2023 5:42 pm
by dark_sylinc

OK I managed to compile and run your sample: What should I look for? (Please one or two problems at a time. Point the ones that have been annoying you the most)

Do I need to press a particular button?
Do I need to uncomment some code?


Re: Few serious questions for Ogre-Next, moving Stunt Rally

Posted: Mon Apr 03, 2023 12:10 am
by Crystal Hammer

Wow, great :D
Did you build stuntrally3 also, or just the ogre3ter-demo project? SR3 is now far from that demo.
I just now updated build info section for stuntrally3 in readme too.
I tried doing a video but, it turned out to be way more consuming than I thought it'd be, plus my clean Debian 11 VM seems unstable or freezing and slow.
If you have any problems building sr3 just post, and I can adjust the section too.


Re: Few serious questions for Ogre-Next, moving Stunt Rally

Posted: Mon Apr 03, 2023 1:07 am
by dark_sylinc

I only tried ogre3ter-demo.

Didn't really check stuntrally3, but I will try later now that you posted the link


Re: Few serious questions for Ogre-Next, moving Stunt Rally

Posted: Sun Apr 09, 2023 1:46 pm
by Crystal Hammer

So I just tried that hint for Reflection Cubemap, to skip faces:

Code: Select all

compositor_node LocalCubemapProbeRendererNode
{
	in 0 cubemap

target cubemap	+X : cubemap_target { execution_mask 1 }
target cubemap	-X : cubemap_target { execution_mask 2 }
target cubemap	+Y : cubemap_target { execution_mask 4 }
target cubemap	-Y : cubemap_target { execution_mask 8 }
target cubemap	+Z : cubemap_target { execution_mask 16 }
target cubemap	-Z : cubemap_target { execution_mask 32 }
}

And in C++:

Code: Select all

Code: Select all

compositorWorkspace->setExecutionMask( (1u << frameCount) );
frameCount = (frameCount + 1) % 6;

And it won't work, log shows 6 times this:

Code: Select all

14:04:33: Compiler error: unknown error in SR3.compositor(127): token "execution_mask" is not recognized

I think it would if execution_mask was inside pass, not in target.
Is it possible to fix this? Or another way of rendering some faces, not all at once for reflection cube?


Re: Few serious questions for Ogre-Next, moving Stunt Rally

Posted: Sun Apr 09, 2023 4:11 pm
by dark_sylinc

You're right on all accounts (it's a pass property, not a target one, there isn't a "quick" fix unless you want to be more verbose).

But you can fix it from C++:

Code: Select all

Ogre::CompositorNodeDef *nodeDef =
	compositorManager->getNodeDefinitionNonConst( "LocalCubemapProbeRendererNode" );

const size_t numTargetPasses = nodeDef->getNumTargetPasses();
assert( numTargetPasses == 6u && "Did definition change? Script and C++ are out of sync" );

for( size_t faceIdx = 0u; faceIdx < numTargetPasses; ++faceIdx )
{
	const Ogre::CompositorTargetDef *targetDef = nodeDef->getTargetPass( faceIdx );
	const Ogre::CompositorPassDefVec &passDefs = targetDef->getCompositorPasses();

for( Ogre::CompositorPassDef *passDef : passDefs )
{
	passDef->mExecutionMask = static_cast<uint8_t>( 1u << faceIdx );
	++faceIdx;
}
}

Re: Few serious questions for Ogre-Next, moving Stunt Rally

Posted: Sun Apr 09, 2023 4:23 pm
by dark_sylinc

Btw I'm trying to build stuntrally3 but I met this problem:

Code: Select all

cmake ../ -DCMAKE_BUILD_TYPE="Debug" -GNinja

-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Using conan: ON
-- GCC detected, adding compile flags
-- Check size of void*
-- Check size of void* - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
-- Conan: Adding rigs-of-rods-deps-V2 remote repository (https://artifactory.anotherfoxguy.com/artifactory/api/conan/rigs-of-rods) verify ssl (True)
usage: conan remote [-h] [-v [V]]
                    {add,auth,disable,enable,list,list-users,login,logout,remove,rename,set-user,update}
                    ...
conan remote: error: unrecognized arguments: True
ERROR: Exiting with code: 2
CMake Error at CMake/conan.cmake:871 (message):
  Conan remote failed='2'
Call Stack (most recent call first):
  CMake/DependenciesFunctions.cmake:6 (conan_add_remote)
  CMake/DependenciesConfig.cmake:1 (include)
  CMakeLists.txt:99 (include)


-- Configuring incomplete, errors occurred!
See also "/home/matias/CRYHAM/dev/sr3/build/CMakeFiles/CMakeOutput.log".

I installed conan via pip3 install conan as in the instructions.

Code: Select all

conan --version
Conan version 2.0.3

whereis conan
conan: /home/matias/.local/bin/conan

I didn't try to look further into the problem. Before debugging anything I wanted to see if you are familiar with the problem.

Edit:
The actual command it tries to run is:

Code: Select all

/home/matias/.local/bin/conan remote add rigs-of-rods-deps-V2  -f https://artifactory.anotherfoxguy.com/artifactory/api/conan/rigs-of-rods True

Re: Few serious questions for Ogre-Next, moving Stunt Rally

Posted: Sun Apr 09, 2023 4:33 pm
by dark_sylinc

Nevermind, fixed it by running:

Code: Select all

pip3 install conan==1.59.0

Re: Few serious questions for Ogre-Next, moving Stunt Rally

Posted: Sun Apr 09, 2023 4:42 pm
by Crystal Hammer

Ok, great, I didn't see such issue before with conan.

So new way builds, but doesn't seem to skip faces.
Where do I setExecutionMask then? Not in workspace?

Actually faceIdx is 1 after that code, not 6.
My SR3.compositor has this for cube reflect node:

Code: Select all

compositor_node CubemapNode
{
	in 0 cubemap

	texture tmpCubemap target_width target_height target_format cubemap mipmaps 0

	target tmpCubemap +X : cubemap_target { execution_mask 1 }
	target tmpCubemap -X : cubemap_target { execution_mask 2 }
	target tmpCubemap +Y : cubemap_target { execution_mask 4 }
	target tmpCubemap -Y : cubemap_target { execution_mask 8 }
	target tmpCubemap +Z : cubemap_target { execution_mask 16 }
	target tmpCubemap -Z : cubemap_target { execution_mask 32
		pass ibl_specular
		{
			input tmpCubemap
			output cubemap
	}	}
}

I'm guessing 1 pass does 6 faces at once?


Re: Few serious questions for Ogre-Next, moving Stunt Rally

Posted: Sun Apr 09, 2023 4:59 pm
by dark_sylinc

OK I managed to compile and run it! (In full Debug!).

NOW WHAT? :lol: (what problems do I look for?)

I can see there are crashes on shutdown in sr-editor3, but I suspect you have more pressing matters.