Amerio.Stephane Posted January 18, 2023 Share Posted January 18, 2023 Hi, I'd like to be able to highlight a specific object at runtime, by adding some kind of transparent overlay over it for a short duration. The object may be any StaticMesh, but it's existing material must remain untouched. The Visualizer::renderSolidObject() would fit my need, but as it's a Visualizer call, it requires that the Visualizer is enabled. But enabling it would also render visible a lot of debug traces we don't want the customer to see. What would be an easy solution? Link to comment
silent Posted January 19, 2023 Share Posted January 19, 2023 Hi Stephane, You can write a custom shader for that. A small example is already available in UnigineScript samples: shaders -> post_selection_00. 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
Amerio.Stephane Posted January 19, 2023 Author Share Posted January 19, 2023 Alas I know about this one, but the issue here is I must not modify the material in any way. To be more explicit, the material may already use Auxiliary for other purposes, or it may be a material graph that doesn't expose the auxiliary channel. So the only way I could think off is to redraw the meshes with an alternate material, but how can I do that? Link to comment
devrom Posted January 19, 2023 Share Posted January 19, 2023 Quote So the only way I could think off is to redraw the meshes with an alternate material, but how can I do that? You could switch to a clone of the object with a different material. Then Unigine would handle rendering. Link to comment
Amerio.Stephane Posted January 19, 2023 Author Share Posted January 19, 2023 1 hour ago, devrom said: You could switch to a clone of the object with a different material How could I do that, without preparing in advance the cloned object. Everything must be done at runtime. Link to comment
devrom Posted January 19, 2023 Share Posted January 19, 2023 Quote How could I do that, without preparing in advance the cloned object. Everything must be done at runtime. Nothing hinders you to call clone on a node during runtime. Of course it would not be optimal for large amount of nodes but if its only one node at a time like in your case it should not be a problem. Link to comment
sweetluna Posted January 19, 2023 Share Posted January 19, 2023 Hi Stephane, You can render objects into a separate texture that you could use as a mask. Notice that you actually want to render only the depth of selected objects. Then just apply custom post effect / scriptable material that will use this mask to determine where to draw an outline. May RenderDoc/Nsight Graphics/Intel GPA bless you Link to comment
Ry_Mik Posted September 26, 2023 Share Posted September 26, 2023 (edited) (исправил текст первого абзаца , который почему-то автозаменился, как будто перевелся на англ, а потом обратно на русский) Извините, а можно новичку продолжить тему? Мне также пришлось столкнуться с подобным, и я стал искать решение. Заливка поверхности декалью, или маской в том или ином виде есть и всё отлично, но вопрос остался с контуром. Изучая семплы я посмотрел и пост-эффект с выделением и эффект собеля, а также подсветку с "auxiliary". Смотрел и Варианты не дают удовлетворительного результата. Вспомогательный материал просто создал дочерний материал от базового, доп заливку с помощью декали. Всё выглядит отлично, кроме контура. Мало того, что я не могу сделать обводку чёрным цветом, так ещё, я не знаю от чего, если перемещать камеру, появляется засветка по краям экрана (например, на экране - сверху). Далее стал пробовать взять шейдер с пост-эффектом. Заливка есть, немного уже другая, но рамка не рисуется вокруг объекта. Только небольшой квадрат (размеры текстуры Маска Альбедо), слева внизу на фоне самого объекта, к которому применяется данный материал. Сразу оговариваюсь, что постэффекты мне не подходят, так как они применяются ко всем объектам, и мне необходимо применить определенное выделение/заливку, только к объектам, выбранным в рантайме. Ну и вот не понимаю, как с этим бороться - если в кадре нет ни одного объекта, к которому применяется шейдер постобработки, получается вот что: Теперь пытаюсь разобраться в семпловом графе пост-эффекта, ту часть, где цикл, ведь рисует он небольшой прямоугольник слева-внизу экрана. Вопрос у меня вот какой план. Постэффекты ведь рисуются уже после подготовки кадра, а во время подготовки кадра, можно ли как-то в графе правильно представить обводку видимой части объекта по координатам, по контуру? Или такие манипуляции необходимо провести уже после подготовки базового изображения, и то, что я хочу нереализуемо? Спасибо. Edited September 27, 2023 by Ry_Mik Внезапный автоперевод с русского на англ и обратно Link to comment
Recommended Posts