rohit.gonsalves Posted July 20, 2020 Share Posted July 20, 2020 (edited) Hi There, It was easy to understand and implement the behavior as defined at https://developer.unigine.com/en/docs/2.11/code/uusl/create_deferred?rlang=cpp I have attached the ULON material file. XML material file, Vertex and Fragment shader. Mostly copied from the above tutorial. But when I did the same with ULON and material file formats, I receive two problems. The object renders black. So I though gbufferdefault is setting black color. But setting color to gbuffer.albedo = vec3(1.0, 0.0, 0.0); didn't work. It renders black. I can not create a child material out of this. Nothing happens. Here is the screen shot. Please advise, Regards, Rohit Edited September 2, 2020 by rohit.gonsalves Changed the title to Solved Link to comment
morbid Posted July 21, 2020 Share Posted July 21, 2020 Hello Rohit, 17 hours ago, rohit.gonsalves said: I have attached the ULON material file. XML material file, Vertex and Fragment shader. I don't see the files. Have you sent them in a PM or just forgot to drop here? Thanks. 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
rohit.gonsalves Posted July 21, 2020 Author Share Posted July 21, 2020 Dear @morbid, I hit the submit before attaching. :-). Here are the files and the version is 2.11.0.2. Rohit mesh_base_color - Copy.basemat mesh_base_color.basemat common_mesh_base.vert filter_mesh_base_color.frag Link to comment
morbid Posted July 22, 2020 Share Posted July 22, 2020 Hello Rohit, When working with GBuffer you need other macros. Instead of MAIN_BEGIN(FRAGMENT_OUT,FRAGMENT_IN) use MAIN_BEGIN_DEFERRED(FRAGMENT_IN) in the fragment shader. MAIN_BEGIN can be used in fragment shader only if you're not filling GBuffer. Thanks! 1 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
rohit.gonsalves Posted July 22, 2020 Author Share Posted July 22, 2020 Thanks Morbid, Understood the problem and solution provided, answered the question. The second issue is still there. I can not create a child material out of it. Please advise. Rohit Link to comment
morbid Posted July 24, 2020 Share Posted July 24, 2020 You're welcome, Rohit. As for the other issue I'm not sure I follow you. I put the shaders and materials into data folder, changed paths to the shaders. After running the editor I'm free to inherit your material. Is the code the same you're using? Nothing changed? Is your material packed in UNG archive? 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
rohit.gonsalves Posted July 24, 2020 Author Share Posted July 24, 2020 (edited) Dear Morbid, You are right. When I put this material in data folder and changed the path for vertex and pixel shader. It did work and I could able to inherit the materiel child. But I found two material Gotchas......... 1] I put the material to the mount point, I couldn't able to inherit it. I mean nothing happens. 2] I put the material to SDK\data\core\materials and shaders at respective places. and then created a new project for UNG packaging. No inheritance. 3] But with data folder it works. Now in case of 3rd point, If I assign a child material of custom material to material_ball and use Shift + Translate; I have transparent material ball. This is some kind of an issue. These are the cases. I think probably a fix is needed for this. Regards, Rohit Edited July 24, 2020 by rohit.gonsalves Link to comment
morbid Posted July 28, 2020 Share Posted July 28, 2020 Rohit, inheritance works for me every time. How I tested: Put your basemat and shaders into <sdk>/data/core and created a project Put the same files in data folder Made manually UNG archive with your material Created a mount point (make sure you're making a Read/Write mount) with custom material Inherit worked in every case. Can you send me core.ung where I can reproduce this issue? On 7/24/2020 at 11:54 PM, rohit.gonsalves said: Now in case of 3rd point, If I assign a child material of custom material to material_ball and use Shift + Translate; I have transparent material ball. This is some kind of an issue. Reproduced this. We'll take a look at this closer this week. Thanks. 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
morbid Posted July 28, 2020 Share Posted July 28, 2020 Got feedback regarding clone issue. It's because you should've used material instancing. Engine has built-in optimization for similar materials rendering. Replace this part float4 row_0 = s_transform[0]; float4 row_1 = s_transform[1]; float4 row_2 = s_transform[2]; With: float4x4 transform = getObjectTransform(IN_INSTANCE); float4 row_0 = getRow(transform, 0); float4 row_1 = getRow(transform, 1); float4 row_2 = getRow(transform, 2); Also you'll need to manifest this: STRUCT(VERTEX_IN) INIT_ATTRIBUTE(float4,0,POSITION) // Vertex position INIT_ATTRIBUTE(float4,1,TEXCOORD0) // Vertex texcoord (uv) INIT_ATTRIBUTE(float4,2,TEXCOORD1) // Vertex basis tangent INIT_ATTRIBUTE(float4,3,TEXCOORD2) // Vertex color INIT_INSTANCE END And add INIT_INSTANCE Hope this helps. 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
morbid Posted July 29, 2020 Share Posted July 29, 2020 Rohit, do you store metafiles of your materials in core folder or ung archive? If no, please try with them. This should solve your inherit issue. 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
rohit.gonsalves Posted July 29, 2020 Author Share Posted July 29, 2020 Dear @morbid, Thanks for looking into these issue. Did not able to check INIT_INSTANCE yet. Will do tomorrow and update regarding that too. Quote do you store meta files of your materials in core folder or ung archive? No. Actually, I am mounting the path from external directory. When this happens, Editor is not creating any meta file for it. Editor internally checks this .meta files for inheritance, doesn't it? If this is the case then I will create meta files by placing it in data folder first and then will copy the same meta file to mount point too. Lets see if that would work. Will keep you posted. Rohit Link to comment
morbid Posted July 30, 2020 Share Posted July 30, 2020 Editor works with assets only, a file without *.meta is not an asset. Editor also uses core folder as read only, so if you manually place some files in core meta won't be created automatically. As for the mounting point — please check if it's not read only. Thanks! 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
rohit.gonsalves Posted August 1, 2020 Author Share Posted August 1, 2020 Dear @morbid, There is no more clone issue after the INIT_INSTANCE and other changes. This is done. :-) Thank you. I am still not able to create a child material from mounted path. I will surely give it a another take with fresh mind. Please allow some time for this test. Will keep you posted. Rohit Link to comment
rohit.gonsalves Posted September 2, 2020 Author Share Posted September 2, 2020 Dear @morbid After making my external mount path writable, the editor created the .meta files and I can create the child material. Thank you very much for all the help to understand it better. Rohit Link to comment
Recommended Posts