[Closed] Hpolygon triangle, colors doesn't work
Hello everyone
unRegisterRedrawViewsCallback li
fn li =(
gw.setColor #fill (color 0 255 255)
gw.setColor #line (color 0 255 0)
gw.hPolyline #([300,50,16], [300,200,8], [450,250,4]) true
--
gw.hPolygon #([200,100,16], [380,100,8], [250,200,4]) \
#((color 255 255 0), (color 0 255 255), (color 0 255 0)) \
#([1.0,.5,0], [0.5,0.5,0], [0,0,0.5])
gw.setTransform(Matrix3 1)
gw.startTriangles()
gw.triangle #([0,0,0], [50,0,0], [50,50,0]) #((color 255 255 0), (color 0 255 255), (color 0 255 0))
gw.triangle #([0,0,0], [50,50,0], [0,50,0]) #((color 255 255 0), (color 0 255 255), (color 0 255 0))
gw.endTriangles()
-- Update the viewports
gw.enlargeUpdateRect #whole
gw.updateScreen()
)
registerRedrawViewsCallback li
In the above script the vertex color doesn’t work. As you can see I tried both hPolygon and triangle. Tested in 3dsmax 2018 and 2020 same result. Tested with dx, nitro, opegnl, software display driver same result. Also gw.setColor #fill (color 0 255 255) doesn’t work.
Only hpolyline seems to work at least is coherent with the line color I set.
I think they are corrupted functions, they get the color from a random state inside the engine.
Attached the output
Let me know if I miss something or there is a workaround.
Thanks
Ok, I did a working test at lest for triangle
unRegisterRedrawViewsCallback li
fn li =(
lim = #()
append lim #zBuffer
append lim #colorVerts
gw.setRndLimits lim
gw.setTransform(Matrix3 1)
gw.startTriangles()
gw.triangle #([0,0,0], [500,0,0], [500,500,0]) #((color 255 0 0), (color 0 0 255), (color 0 255 0))
gw.triangle #([0,0,0], [500,500,0], [0,500,0]) #((color 255 0 0), (color 0 255 0), (color 0 255 255))
gw.endTriangles()– Update the viewports
gw.enlargeUpdateRect #whole
gw.updateScreen())
registerRedrawViewsCallback li
The problem is related to polygon hpolygon and wpolygon. Maybe they are corrupted?
I need to render a quad screen with an image, only these function accept in input uv coord.
Thanks
there’s no bug you need to set the correct render limits
unRegisterRedrawViewsCallback li
fn li =
(
gw.setRndLimits #(#lighting,#backcull,#colorVerts)
gw.setTransform(Matrix3 1)
gw.startTriangles()
gw.triangle #([0,0,0], [50,0,0], [50,50,0]) #([255,255,0], [0,0,255], [0,0,0])
gw.triangle #([0,0,0], [50,50,0], [0,50,0]) #([255,255,0], [0,255,255], [0,255,0])
gw.endTriangles()
-- Update the viewports
gw.enlargeUpdateRect #whole
gw.updateScreen()
)
registerRedrawViewsCallback li
Thanks for your help, but read my previous post.
The problem is related to polygon hpolygon and wpolygon.
I hacked the projection to draw in 2d with triangle, but is something that can works only in sdk, not in maxscript.
from the sdk for hPolygon
Point3 *rgb The color values at the vertices. The rendering mode must include GW_ILLUM for these values to be used. Note: The use of these colors is not supported under the OpenGL driver. The rgb values are ignored. Only the current material is taken into consideration. (This is how OpenGL works.)
Already done, tested GW_ILLUM flag with different drivers opengl, directx and software raster. I tested with different 3dsmax version from 2014 until the last one, and the result is always the same. As I told you I fixed using triangle functions. I sent an email to the Autodesk to show them the problem and fix at least the documentation. A warning on these functions should be really appreciate by the developers.