sergey.pozhidaev Posted October 8, 2015 Share Posted October 8, 2015 hi, how specify in Materials one texture for Multiple Shaders (vertex & evaluate) from single unit? Link to comment
ulf.schroeter Posted October 8, 2015 Share Posted October 8, 2015 I think by binding a textures to a certain unit (e.g. 8 in the following example, make sure to use a unit NOT allocated by the base material). This works at least for vertex/fragment shader, though I don't know if it also works for evaluate shader. <material name="mesh_overlay_base" parent="mesh_base" editable="0"> <!-- deferred shaders --> <shader pass="deferred" object="mesh" defines="BASE_DEFERRED" alpha_test_defines=",ALPHA_TEST" alpha_fade_defines=",ALPHA_FADE" deferred="1" detail_defines=",OVERLAY_0,OVERLAY_1,MULTIPLY_0,MULTIPLY_1" parallax_defines=",PARALLAX" emission_defines=",EMISSION" volumetric_defines=",VOLUMETRIC" vertex="core/shaders/default/mesh/vertex_base.shader" fragment="rde/shaders/mesh/fragment_overlay_base_deferred.shader"/> <!-- ambient shaders --> <shader pass="ambient" object="mesh" defines="BASE_AMBIENT,AMBIENT" alpha_test_defines=",ALPHA_TEST" alpha_fade_defines=",ALPHA_FADE" ambient_defines="0,OPACITY,TRANSPARENT,LIGHTMAP" detail_defines=",OVERLAY_0,OVERLAY_1,MULTIPLY_0,MULTIPLY_1" parallax_defines=",PARALLAX" emission_defines=",EMISSION" vertex="core/shaders/default/mesh/vertex_base.shader" fragment="rde/shaders/mesh/fragment_overlay_base_ambient.shader"/> <!-- bindings --> <bind object="mesh_dynamic" to="mesh"/> <!-- textures --> <texture name="overlay" anisotropy="1" unit="8">rde/textures/world-country-colors.dds</texture> <!-- parameters --> <parameter name="overlay_scale" type="slider" shared="1" min="0.0" max="1.0" flags="max_expand">0.0</parameter> </material> Link to comment
sergey.pozhidaev Posted October 8, 2015 Author Share Posted October 8, 2015 "tess_elevations" is need to be in vetex & evaluation: <material name="mesh_Tess" parent="mesh_tessellation_base"> <!-- textures --> <texture name="tess_diffuse" unit="7" shader="fragment" filter="bilinear">core/textures/mesh_base_height.dds</texture> <texture name="tess_elevations" unit="8" filter="bilinear">core/textures/mesh_base_height.dds</texture> </material> in this case tess_elevations (s_texture_8) empty in both shaders Link to comment
forhaxed Posted October 13, 2015 Share Posted October 13, 2015 Hi Sergey! Please show the shader sources, I'm wondering if you're using correct samplers. Link to comment
sergey.pozhidaev Posted October 13, 2015 Author Share Posted October 13, 2015 evaluate shader: /******************************************************************************\ * * Direct3D11 * \******************************************************************************/ #elif DIRECT3D11 #ifdef USE_TESSELLATION && TESSELLATION #include <core/shaders/default/common/evaluate_base.h> #include <shaders/mesh_Tess/evaluate_base.h> Texture2D s_texture_0 : register(t0); Texture2D s_texture_8 : register(t8); //elev [domain("tri")] EVALUATE_OUT main(EVALUATE_CONSTANT_IN IN,const OutputPatch<EVALUATE_IN,3> patch) { ... float4 elev = s_texture_8.SampleLevel(s_sampler_8,texcoord.xy, 0) * 65536.0f; } vertex shader: /******************************************************************************\ * * Direct3D11 * \******************************************************************************/ #elif DIRECT3D11 Texture2D s_texture_0 : register(t0); Texture2D s_texture_8 : register(t8); //elev VERTEX_OUT main(VERTEX_IN IN) { ... float4 elev = s_texture_8.SampleLevel(s_sampler_8,texcoord.xy, 0) * 65536.0f; } in this case empty textures, only if s_texture_8(vertex) & s_texture_6(evaluate) units works. Link to comment
forhaxed Posted October 16, 2015 Share Posted October 16, 2015 Please prepare the independent test scene and attach it to your message, we couldn't reproduce the problem. Link to comment
sergey.pozhidaev Posted October 22, 2015 Author Share Posted October 22, 2015 https://developer.unigine.com/en/gtfl/388 opengl & directx variants with textures (different behaviour) Link to comment
silent Posted October 28, 2015 Share Posted October 28, 2015 Hi Sergey, If I understand your test scene right - OpenGL variant of your shaders is working correctly, but DX11 is not?We are in the middle of tessellation shader refactoring for Unigine 2.1-2.2 versions. Updated shader will use the new unified DX11/GL format, so the development and debugging process will become a little bit easier. We also keeping in mind your previus request for quad patches sample. At this time I can only recommend to use OpenGL version of your shader if it fit your needs. How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
sergey.pozhidaev Posted October 28, 2015 Author Share Posted October 28, 2015 in scene two equal textures for 2 texture slots (for vertex & evaluation shader), using one texture slot in both shaders makes zero elevations, there is comments (//zero elevs, //nonzero elevs) in code. main quest - use one texture for both shaders Link to comment
Recommended Posts