About Store Forum Documentation Contact
Donations:
309$/mo



Post Reply 
Shadered material usage as ImagePtr
Author Message
Hokan Offline
Member

Post: #1
Shadered material usage as ImagePtr
To get natural moon image during day circle, I want to blend moon's pixels with sky pixels, based on relative moon-to-sky position. Cause this operation should be real-time shaders can handle it.

I've searched around, found some pretty good help threads. For anybody would like to read them, catch kind of aggregation:
Shader-related problem
http://www.esenthel.com/community/showth...p?tid=8093
or
Shader image problem
http://www.esenthel.com/community/showth...p?tid=7801
or
CustomShader Path in 2.0
http://www.esenthel.com/community/showth...p?tid=6056
or
Custom shader in editor
http://www.esenthel.com/community/showth...p?tid=5265
and really good step-by-step guide (which should definitely be in some sort of Wiki):
Custom Shader Learning Project
http://www.esenthel.com/community/showth...p?tid=8143

But each thread, suggest user apply custom shader on material via someMaterialInstance.user_shader = CUSTOM_SHADER_EMUNARATION_VALUE;.

My question - is it possible, to apply shader to Image/ImagePtr instance?
Sure, not Image nor ImagePtr have any "setShader"-like methods, and I see only one option - make Material instance, apply shader, get ImagePtr from shadered material, pass this pointer to Astro->image. Is it possible? Is there a better way?

And a little bit more questions:
  1. Is it true, that only source code licensee have ability to write their own shaders?
  2. Is it wise, to use any sort (GLSL, HLSL, Esenthel Shader Language) precompiled shaders in release application? I've read that precompiled shaders don't offer any compatibility between different graphic cards
  3. Just curious, is there any necessity to write own shader language/shader language wrapper, rather than use GLSL, HLSL or Cg? Only due to generalisation?
09-03-2015 11:39 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Shadered material usage as ImagePtr
Hi,

Why not just use Alpha Blending, draw the image with different opacity?

To create shaders the easiest way would be to grab the source license, add some custom shader techniques to existing shaders, and recompile them.
This is however a bit complex process at the moment.

You can apply custom shaders to 2D graphics, using VI (please see tutorials for VI). In that case just do VI.shader(..) before drawing.

1) that's the easiest way, but still not so easy
2) once you adjust the shader codes and recompile them for DX9/DX10/GL, they will work everywhere (DX shaders are stored in shader binary code, while GL shaders are stored in text mode)
3) EE uses HLSL with some helpful macros to allow writing shaders once but being able to compile on DX9/DX10/GL

Shader creation needs to be redesigned in the engine, and I have an idea how to do it, unfortunately it's a very time consuming process and it has to wait for the future.
09-05-2015 12:13 AM
Find all posts by this user Quote this message in a reply
Hokan Offline
Member

Post: #3
RE: Shadered material usage as ImagePtr
Quote:Why not just use Alpha Blending, draw the image with different opacity?

You mean Image::draw3D method? Well, I would like not to make any hacks and use engine API and structures as much as possible, and Astro object already has ImagePtr member, moreover EE control its rendering, so I think it will be more accurate, to change rendering "style" via shaders, rather than render it on my own.

Quote:To create shaders the easiest way ...
And which one is not easiest? smile
09-07-2015 07:19 AM
Find all posts by this user Quote this message in a reply
Zervox Offline
Silver Supporter

Post: #4
RE: Shadered material usage as ImagePtr
Use the shader compilation made by 3DRaddict

http://www.esenthel.com/forum/showthread.php?tid=8143
09-07-2015 11:02 AM
Find all posts by this user Quote this message in a reply
Hokan Offline
Member

Post: #5
RE: Shadered material usage as ImagePtr
This is exactly what Esenthel already said, btw, I mentioned this thread in first post, thanks smile
09-07-2015 01:09 PM
Find all posts by this user Quote this message in a reply
Post Reply