Redraw Views Callback (constantly calling)

fn _redrawviewsCB = (format ">> %\n" (timestamp()))
registerredrawviewscallback _redrawviewsCB

unregisterredrawviewscallback _redrawviewsCB

This is a well-known “feature” that has been asked about several times on this and other forums.
Yes, this event is constantly triggered with the Nitrous viewport.

So I have a question:
Has anything changed since Nitrous came along and can we recognize anyhow the first (forced redraw) and next (progressive) calls?


In early versions of Nitrous, some gw methods did not work correctly in progressive calls, but unfortunately this has been fixed … :stuck_out_tongue_winking_eye:


i reported this, it was fixed for 2022, and then someone forgot to put it into the final release

btw. what exatly it “progressive update” for ?
512 steps to refine AO/shadows and they look like crap, and this in times of realtime raytracing ?
ever tried to make a viewport anim when using ao or shadows ?
ok, max is not a game-engine, but this is more on the ridiculous side of things

there was one case where this “feature” nearly fried my gfx-board, constantly updating 300 million polys in viewport


fortunately, this is not entirely true. :upside_down_face:
they use some kind of “hash” and stop redrawing when everything is drawn. But RedrawViews message keeps running … But why should they do this remains a mystery to me. :stuck_out_tongue_winking_eye:


With this little tool I can see when the progressive rendering start/stops. In all max versions it has (apparently) a value of 512 calls.

In Max 2022 this never stops, meaning the Viewport Callback is constantly called, no matter what.

	try (destroydialog ::RO_VIEWPORT) catch()
	rollout RO_VIEWPORT "Viewport Callback" width:180 height:80
		checkbutton bt_enable     "Enable" width:128 height:32
		label       lb_calls      "Calls:0"
		label       lb_inProgress "In Progress: false"
		local ended = true
		local calls = 0
		fn RedrawviewsCallback =
			finished = NitrousGraphicsManager.IsProgressiveRenderingFinished()
			calls += 1
			lb_calls.text = "Calls:" + (calls as string)
			if ended and not finished then
				lb_inProgress.text = "In Progress: true"
				ended = false
				if finished do
					lb_inProgress.text = "In Progress: false"
					ended = true
					calls = 0
		on RO_VIEWPORT close do
			unregisterredrawviewscallback RedrawviewsCallback
		on bt_enable changed arg do
			if arg then registerredrawviewscallback RedrawviewsCallback else unregisterredrawviewscallback RedrawviewsCallback
	createdialog RO_VIEWPORT


can i pass this script to max-devs ?


Sure. Thank you! :+1:


did you notice that it does this also in 2021 ?


I tested it in Max 2014, 2016 and 2022, but I can now confirm the behavior is the same in Max 2021 and 2022.

I supposed the Progressive Rendering was triggered only in High Quality setting with shadows and/or AO, but in Max 2021 and 2022 it just keeps running with any setting in any viewport.

Perhaps it is somehow related to the Viewport Callback functions introduced in Max 2021.1?


does the polygon count utility still exist in 2021/22 ? that registers a RegisterRedrawViewsCallback may be useful to add a line to print the poly count to the listener or if you can tell it’s having a fit from any kind of ui flicker.

PolyCountCallback::proc(Interface* ip)


This is what worries me … A lot of old services (interfaces, plugins, etc.) in MAX register RedrawViews Callback. Can they slow down the system now? When they were written, there were no constant calls…


It is still present in Max 2022 and after 10 minutes of not interacting the color bars keep flickering from time to time, which indicates it is constantly running.


In Max 2021 and 2022 the SDK ViewportDisplayCallback is also constantly called, except when Max loses focus, as far as I could test.